#36773: ManyToMany related manager .count() returns 0 while .all().count()
returns
correct value (Django 5.2.9 and 6.0.0)
-------------------------------------+-------------------------------------
Reporter: DanielDavtyan | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 6.0 | Severity: Release
| blocker
Keywords: count, django, orm | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Environment
Django: 5.2.9
Python: 3.12.x
Database: PostgreSQL
OS: (e.g. Ubuntu 22.04 – fill in)
The same code previously worked correctly on Django 4.x. After upgrading
to Django 5.x (now 6.0), I see a discrepancy between ManyToMany related
manager .count() and .all().count() in tests.
This looks similar to the regression tracked as #36197, which was fixed
for ManyToManyField related managers using a through model with to_field,
but I am still seeing the same symptom on Django 5.2.9.
--
Ticket URL: <https://code.djangoproject.com/ticket/36773>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019ae929ef0b-734dff5b-32ba-45ef-bc6e-0a6819146f73-000000%40eu-central-1.amazonses.com.