#34443 closed Bug (fixed)
Filtering reverse relations against invalid lookups crashes.
Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.2 |
Severity: | Release blocker | Keywords: | |
Cc: | Simon Charette, David Wobrock | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Filtering reverse relations against invalid lookups crashes.
from django.db import models class Author(models.Model): name = models.CharField(max_length=10) class Report(models.Model): name = models.CharField(max_length=10) creator = models.ForeignKey(Author, models.CASCADE) >>> Author.objects.filter(report__title="first") ... File "/django/django/db/models/expressions.py", line 380, in get_transform return self.output_field.get_transform(name) AttributeError: 'ManyToOneRel' object has no attribute 'get_transform'
In Django 4.1 it raises django.core.exceptions.FieldError: Related Field got invalid lookup: title
.
Regression in ce6230aa976e8d963226a3956b45a8919215dbd8.
Change History (4)
comment:1 by , 21 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 21 months ago
Has patch: | set |
---|
Note:
See TracTickets
for help on using tickets.
PR