#36442: Reusing same instance of FilteredRelations in multiple queries result in
django.core.exceptions.FieldError: Cannot resolve keyword
-------------------------------------+-------------------------------------
Reporter: Viliam Mihálik | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: FilteredRelation, | Triage Stage: Accepted
ORM |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Viliam Mihálik):
I can look at it.
I checked the code, and after debug, .clone method is never called. So my
suggestion is to clone annotation before "rename" here
https://github.com/django/django/blob/main/django/db/models/query.py#L1728
and simply change `clone.query.add_filtered_relation(annotation, alias)`
to `clone.query.add_filtered_relation(annotation.clone(), alias)`
--
Ticket URL: <https://code.djangoproject.com/ticket/36442#comment:2>
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/0107019741fdfbfc-afee5336-92ac-4c95-a47e-4a9aee9434df-000000%40eu-central-1.amazonses.com.