-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When ideas fail declared:
> Hi, I was wondering what is the simpliest way to count the number of
> objects returned in a QuerySet?
> 
> Basically i have a blog and i want to count the number of comment
> relating to each post and display it, the blog posts are shown on a
> seperate page to the comments but i guess you would still have to
> create the query set in the posts view so that you can count the
> results.

Try appending '.count()' to the end of your query!

http://docs.djangoproject.com/en/dev/ref/models/querysets/#count

- --
Randy Barlow
Software Developer
The American Research Institute
http://americanri.com
919.228.4971
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkp5opQACgkQw3vjPfF7QfWLIgCfXtC6uKghLldclw6euN5CeeEl
qB0AoIgMZ4b7CB5wX4hWGazTsx1jjUOT
=fo+f
-----END PGP SIGNATURE-----

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