I have a model that looks something like this:

class Collection(models.Model):
 user = models.ForeignKey(User)
 item = models.ForeignKey(Items)
 date = models.DateTimeField()

I'm trying to retrieve a list of unique users ordered by the last time
they added something to their collection.
I would expect this to work:
distinct_users = User.objects.order_by('collection__date').distinct()[:
5]
This query returns a list of users, but the users are not distinct.

How do I do this the right way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to