#30655: len(queryset) and queryset.count() return different results.
-------------------------------------+-------------------------------------
Reporter: Sander Kleijwegt | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by felixxm):
Nope. You should use `count()`, but you should know what you want to
count. If you want to count the no. of `Bar`'s then
`Bar.objects.all().count()` is a obvious choice and it's natural for me
that ordering doesn't impact this value. If you want to count the no. of
`Foo`'s then use `Foo.objects.all().count()`, etc.
--
Ticket URL: <https://code.djangoproject.com/ticket/30655#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.49a36e7c1efa4e63bb14640e7c914bc1%40djangoproject.com.