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)



Thanks

On Sun, Jan 15, 2012 at 1:05 AM, Swaroop Shankar V <[email protected]>wrote:

> hello All,
> I have a model of following structure
>
> class ExtraInfomration():
>
> user = models.OneToOneField(User)
> total_likes = models.IntegerField(_('Total Likes'), null=True, blank=True,
> default=0)
> total_dislikes = models.IntegerField(_('Total Dislikes'), null=True,
> blank=True, default=0)
> popularity = models.FloatField(_('Popularity'), null=True, blank=True,
> default=0.0)
> created_on = models.DateTimeField(auto_now_add = True, null=True)
> updated_on = models.DateTimeField(auto_now=True)
>
> I have another model for profile. I need to retrieve users ordered by the
> popularity from the User model. This is the code am using to retrieve the
> users list
> userObject = User.objects.filter(is_active=1,is_staff=0,is_superuser=0)
>
> how can i order the data based on the popularity field in
> extrainformation? Thanks
>
> Regards,
>
> Swaroop Shankar V
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Digitally,
Arun Prabhakar <http://digitalpbk.com>
<https://www.facebook.com/digitalpbk>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to