News for hackers. Stuff that matters.
Re:Django 5.0 Is Released by cdcarter on Monday December 04, 2023 @01:23PM (#38520926)
GeneratedField looks interesting, but I'm not _really_ sure what gains I get over just calling annotate() on my queryset with some computed fields. At least on the backends where the computed GeneratedField isn't stored.
Re:Django 5.0 Is Released by radus on Monday December 04, 2023 @01:32PM (#38521072)
It's easier to re-use if you need the same generated field in multiple places.
Re:Django 5.0 Is Released by cdcarter on Monday December 04, 2023 @02:06PM (#38521589)
I've been in the habit of replacing the default manager for my model with one with an annotated query set. that way, any Model.objects.all() call will have the computed fields.

I find this pretty easy to get used to and re-use. though I do admit I like them defined as actual model-fields with verbose names etc...

Re:Django 5.0 Is Released by OJFord on Monday December 04, 2023 @06:20PM (#38524635)
It's a generated column in the database, vs. annotate is just a python alias for something you're selecting in the query.
Re:Django 5.0 Is Released by tmnvix on Monday December 04, 2023 @10:05PM (#38526595)
Actually having the derived data in the database would be helpful for simplifying something like a website search implementation. I know I could have used it last month!