Saturday, August 14, 2010

Re: django queryset get only one result for one column pair

Actually there may be many submissions with a user-problem pair but i
want to list only the last one per user - problem pair.
Like:

let p1 be two problems , u1, u2 be two users and s1,s2 two submissions
by user u1 on problem and s3,s4 by u2.

so i want to get a queryset with only the last submission by u1,u2 on
p1.

On Aug 14, 5:57 pm, Kenneth Gonsalves <law...@au-kbc.org> wrote:
> On Sat, 2010-08-14 at 05:45 -0700, Rohan Jain wrote:
> > I have a field 'submission' which has a 'user' and a 'problem'.
> > How can i get a django queryset search result which will give a list
> > of only one result per user-problem pair.
>
> does your model not have a unique_together for user and problem?
> --
> regards
> Kenneth Gonsalves

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate