1👍
✅
You couldn’t do that in one query if you need the results to be MyModel
objects, but you could get field a
and latest create_ts
together with django queryset values
method:
MyModel.objects.values('a').annotate(latest_date=Max('create_ts'))
Source:stackexchange.com