Opened 2 years ago
Last modified 2 years ago
#34957 closed Bug
Cannot filter over annotated "FilteredRelation" since Django 5 — at Initial Version
| Reported by: | younes-chaoui | Owned by: | nobody |
|---|---|---|---|
| Component: | Uncategorized | Version: | 5.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
After updating to django 5.0b1 I get test fails when using a filter over annotated "FilteredRelation". This is an example :
from django.db.models import F, FilteredRelation, Q
visites = (
Visite.objects.all()
.annotate(
etat_at_date_de_visite=FilteredRelation(
"site__siteusage__etats",
condition=Q(site__siteusage__etats__date_valeur=F("date_de_visite")),
)
)
.filter(etat_at_date_de_visite__isnull=False)
)
print(visites)
Note:
See TracTickets
for help on using tickets.