Tuesday, August 30, 2016

Re: A tricky query in one to many relationship - atleast for me:)

> for b in B.objects.all().select_related('a').annotate(Max('date_created')):

That should probably be: Max('a__b__date_created') instead.

Erik

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/E911BFD1-0A2A-4943-AC80-E09D68C1A464%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment