On Jan 16, 8:04 am, Arun P <arun....@gmail.com> wrote:
> Does this work?
>
> info =
> ExtraInformation.objects.filter(user__is_active=1,user__is_staff=0,user__is_superuser=0).order_by("popularity").select_related("user")
>
> users = map(lambda i: i.user, info)

That was for the "uselessly complicated and memory-hungry" method. Now
for the "simple lazy" method:

=> users = User.objects.filter(<you filters
here>).order_by("extrainformation__popularity")

@OP : You can add a select_related if you plan on using data from
ExtraInformation so you save on useless queries.

-- 
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