Thursday, July 19, 2012

Get count using annotate

Hi,

my models is-

class Students(models.Model):
        country = models.ManyToManyField( Country )

I want to calculate the total number of student objects for each of the country objects.

I need the count of students interested in each country so far in my database.

I was trying something with annotate but couldnt get far.

I need suggestions :)

Thanks . cheers !

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/omOED8-Lj6sJ.
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.

No comments:

Post a Comment