@CodenameTim@fosstodon.org avatar

CodenameTim

@CodenameTim@fosstodon.org

Gardener, homebrewer, bread baker and hot sauce maker. Assister with Django Debug Toolbar.
Jazzband | DEFNA | he/him

This profile is from a federated server and may be incomplete. Browse more on the original instance.

bmispelon, to django
@bmispelon@mastodon.social avatar

New article on my blog: a ORM technique I found for combining JSONObject and Subquery to build model instances: https://blog.bmispelon.rocks/articles/2024/2024-05-09-django-getting-a-full-model-instance-from-a-subquery.html

CodenameTim,
@CodenameTim@fosstodon.org avatar

@bmispelon 🤩 this functionality is something that belongs in the ORM ideally. I think a third party library is a good starting point, but I'd vote for it to go straight to main. People frequently want to fetch a list of discussion threads and the latest post of each thread. Your idea is perfect for that scenario!

CodenameTim,
@CodenameTim@fosstodon.org avatar

@bmispelon I don't know enough about the ORM if this bootstrapping approach has some unseen performance penalty. @lilyf maybe you have some insight?

joshdholtz, to random
@joshdholtz@mastodon.social avatar

🍕 And just like that… @DeepDishSwift is over

✅ Speakers delivered amazing talks
✅ Sponsors gave off amazing energy
✅ Attendees were so great to talk to and I saw so many new friendships made

Now… it’s time to rest 💤

CodenameTim,
@CodenameTim@fosstodon.org avatar

@joshdholtz @DeepDishSwift congrats Josh!

josh, (edited ) to random
@josh@joshthomas.dev avatar

What’s your typical async application look like in Django? I’m starting to dip my toes in after primarily just working sync and am running in to brick wall after brick wall.

I’ve got a “toolbox” app at work with a few small Django apps to help out our small department in various things and wanted to async something to deal with GitHub webhooks. Using Django 5.0 and daphne.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@josh we're hoping to close that gap this summer with a GSoC project.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@josh no, definitely not. You're voicing the reason we've been trying to implement it for the past few years. I'm excited to see how much of it we can achieve.

I'm a bit worried about how we instrument SSE or other responses that aren't tied to an explicit request. But we'll figure something out!

blaise, to til
@blaise@fosstodon.org avatar

that the project has a process for training contributors
https://github.com/djangonaut-space/program/blob/main/README.md

Not only is it well structured, it also has support from more experienced djangonauts. Sadly, it has concluded for this year. If you're interested in and want to develop experience contributing to , then you may want to mark your calendar for next year.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@blaise @webology Please do!

Was there something in the docs that referenced Jan? If there's something we can communicate more clearly, let me know or @djangonaut know.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@blaise @webology @djangonaut Ah, yeah. The ordering on the site needs to be flipped. We have a PR that addresses that here: https://github.com/djangonaut-space/wagtail-indymeet/pull/392

We just need to get it over the finish line.

nicole, to random
@nicole@tietz.social avatar

Today is May 4. Many know it as Star Wars day, but to me it’s forever associated with the May 4 massacre on Kent State’s campus. It feels more relevant than ever.

The song “Ohio” is about these events and is a fantastic song, too. Worth a listen today.
https://m.youtube.com/watch?v=EI1gcH2XCEw

CodenameTim,
@CodenameTim@fosstodon.org avatar

@nicole I thought NPRs article with a protester from the past was pretty good. https://www.npr.org/2024/05/04/1249023924/kent-state-shooting-activists-protests-survivor

baconandcoconut, to random
@baconandcoconut@freeradical.zone avatar

Has anyone ever been brave enough to see if big cats (tigers, jaguars, lions, etc.) like catnip? #thursdaythoughts

CodenameTim,
@CodenameTim@fosstodon.org avatar

@baconandcoconut 100% the tiger king tried this.

CodenameTim, to django
@CodenameTim@fosstodon.org avatar

Coming back at update_or_create for round 2!

If you call update_or_create where the instance already exists and the defaults passed in are already the values on the instance, do you ever want it to actually re-save the instance?

I'm running into the case where I'd prefer it to not update the instance if it doesn't need to. I'm guessing I'm overlooking some race condition problem though.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@fallenhitokiri That would be a tough one. I'd argue that since nothing else is being updated, you wouldn't want that timestamp being touched.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@fallenhitokiri And that's probably the nail in the coffin for the argument to change it.

BUT.

I'd argue the savings of not issuing an update > the heartbeat example. Especially considering you could replace it with update_or_create(id, {'updated': timezone.now()}) whereas you have to re-implement update_or_create to get that performance optimization.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@webology I'm realizing that this problem is only a major problem when using django-simple-history where it creates a historical record on every save. These empty saves add up if they occur on a regular basis.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@fallenhitokiri I see two reasons for the updated timestamp column. One is for a heartbeat like you described. The other is for a last modified. In that latter case, if nothing has been modified, it's more confusing to have that timestamp changed.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@ryanhiebert @webology Welp, maybe I should create that issue on the repo for a library specific utility function.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@ryanhiebert @webology Pretty sure bulk_create with update_conflicts is an upsert for postgres now.

CodenameTim,
@CodenameTim@fosstodon.org avatar
CodenameTim,
@CodenameTim@fosstodon.org avatar

@treyhunner @webology @ryanhiebert There's the option to disable it before calling a save operation. But that's generally manual. Or you'd have to roll your own comparison to determine whether to set skip_history_when_saving

mahryekuh, to random
@mahryekuh@fosstodon.org avatar

Open source contributors, what did you wish you knew when you started contributing? Or is there something that kept you from contributing for too long?

I am asking for a presentation, which I will give in two weeks.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@mahryekuh smallish, regular contributions go a long way.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@mahryekuh For me it was the idea that small changes didn't make an impact, so it wasn't worth the high effort to get started and do them.

derwaro, to django
@derwaro@fosstodon.org avatar

When having a App deployed to .io @flydotio what's the best way to read the actual Django logs? Store them in volumes? Or stream them to some S3? I get a 500 response in the browser sometimes and want to see the actual stacktrace.

CodenameTim,
@CodenameTim@fosstodon.org avatar

@derwaro Have you considering installing Sentry?

josh, to random
@josh@joshthomas.dev avatar

Wrote about cracking the case of the missing time zone data. Where did it go? Did I cause it or was it an upstream bug?

(Spoiler: it was me..)

https://joshthomas.dev/blog/2024/debugging-a-no-time-zone-found-error-while-using-the-official-playwright-docker-image/

CodenameTim,
@CodenameTim@fosstodon.org avatar

@josh Yikes, that's a gnarly one to untangle. Nice write-up!

I laughed at:
> It had been just long enough since making the Playwright change that I had completely forgotten that the call was coming from inside the house.

CodenameTim, to django
@CodenameTim@fosstodon.org avatar

Google Summer of Code projects have been announced and had four projects accepted!

https://summerofcode.withgoogle.com/programs/2024/organizations/django-software-foundation-8o

ehmatthes, to random
@ehmatthes@fosstodon.org avatar

All right, here's a fun Django question:

You start a simple project, using SQLite locally. You write a model, then call makemigrations, then call migrate.

At what point is the db.sqlite3 file created?

CodenameTim,
@CodenameTim@fosstodon.org avatar

@ehmatthes I would have assumed migrate, but I'm guessing makemigrations because it needs to check the django_migrations table to determine which migrations have been applied.

_chrismay, to random
@_chrismay@fosstodon.org avatar

After a month and a half of working nearly full-time looking for a job, I accepted an offer today.

I'm worn out and looking forward to a little time off before I start something I'm better at. 🙂

CodenameTim,
@CodenameTim@fosstodon.org avatar

@_chrismay Congratulations Chris! That's always a challenge and a relief.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • InstantRegret
  • ngwrru68w68
  • Durango
  • Youngstown
  • slotface
  • mdbf
  • rosin
  • PowerRangers
  • kavyap
  • DreamBathrooms
  • anitta
  • vwfavf
  • hgfsjryuu7
  • cisconetworking
  • osvaldo12
  • everett
  • ethstaker
  • GTA5RPClips
  • khanakhh
  • modclub
  • tester
  • cubers
  • normalnudes
  • provamag3
  • All magazines