Opened 12 months ago

Last modified 12 months 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)

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top