#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.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018727881a28-6c6beb41-90d2-4cd8-851c-7060e3fb7750-000000%40eu-central-1.amazonses.com.

Reply via email to