[Django] #34443: Filtering reverse relations against invalid lookups crashes.

7 views
Skip to first unread message

Django

unread,
Mar 28, 2023, 5:24:07 AM3/28/23
to django-...@googlegroups.com
#34443: Filtering reverse relations against invalid lookups crashes.
-------------------------------------+-------------------------------------
Reporter: Mariusz | Owner: Mariusz Felisiak
Felisiak |
Type: Bug | Status: assigned
Component: Database | Version: 4.2
layer (models, ORM) |
Severity: Release | Keywords:
blocker |
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Filtering reverse relations against invalid lookups crashes.

{{{#!python
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/34443>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 28, 2023, 5:58:36 AM3/28/23
to django-...@googlegroups.com
#34443: Filtering reverse relations against invalid lookups crashes.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz

| Felisiak
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/34443#comment:1>

Django

unread,
Mar 28, 2023, 2:11:20 PM3/28/23
to django-...@googlegroups.com
#34443: Filtering reverse relations against invalid lookups crashes.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/16695 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34443#comment:2>

Django

unread,
Mar 28, 2023, 3:04:04 PM3/28/23
to django-...@googlegroups.com
#34443: Filtering reverse relations against invalid lookups crashes.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed

Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"996c802229b93fe83c39842e56c6b8668464deaf" 996c8022]:
{{{
#!CommitTicketReference repository=""
revision="996c802229b93fe83c39842e56c6b8668464deaf"
Fixed #34443 -- Fixed filtering by transforms on reverse relations.

Regression in ce6230aa976e8d963226a3956b45a8919215dbd8.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34443#comment:3>

Django

unread,
Mar 28, 2023, 3:04:17 PM3/28/23
to django-...@googlegroups.com
#34443: Filtering reverse relations against invalid lookups crashes.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"f12dc36754bf24aeb3da79f18fc3c9a3ae1089e0" f12dc36]:
{{{
#!CommitTicketReference repository=""
revision="f12dc36754bf24aeb3da79f18fc3c9a3ae1089e0"
[4.2.x] Fixed #34443 -- Fixed filtering by transforms on reverse
relations.

Regression in ce6230aa976e8d963226a3956b45a8919215dbd8.
Backport of 996c802229b93fe83c39842e56c6b8668464deaf from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34443#comment:4>

Reply all
Reply to author
Forward
0 new messages