1👍
Found the answer here:
Django query that get most recent objects from different categories
authors = Author.objects.annotate(latest_entry_published_on=Max('entries__published_on'))
entries = Entry.objects.filter(published_on__in=[a.latest_entry_published_on for a in authors])
0👍
I’d try something like:
Entry.objects.order_by('-published_on').values_list('author_id').distinct()
- [Answer]-Is it possible to parse excel files in the forms.py?
- [Answer]-Django Tincymce, AttributeError: 'NoneType' object has no attribute 'endswith'
- [Answer]-Python settings.py on windows
- [Answer]-Issue with pip installing django in ubuntu server virtualenv
- [Answer]-Strange warning on my tests
Source:stackexchange.com