Your Ad Here

Saturday, January 14, 2012

Joining tables

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