#27268: Regression on error message for invalid related fields lookup in
QuerySet.get()
-------------------------------------+-------------------------------------
     Reporter:  François Freitag     |      Owner:  nobody
         Type:  Bug                  |     Status:  new
    Component:  Database layer       |    Version:  master
  (models, ORM)                      |   Keywords:  get lookup related
     Severity:  Normal               |  fields
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 The expected error message for an invalid lookup in a `get()` operation
 shoud look like:
 {{{
 Related Field got invalid lookup: foo
 }}}

 The current error message is:
 {{{
 TypeError: 'NoneType' object is not callable
 }}}

 Steps to reproduce:
 **models.py**
 {{{#!python
 class Tag(models.Model):
     text = models.CharField(max_length=100, unique=True)

 class Thing(models.Model):
     name = models.CharField(max_length=100)
     tags = models.ManyToManyField(Tag)
 }}}

 **tests.py**
 {{{#!python
 def test_invalid_lookup(self):
     with self.assertRaisesMessage(TypeError, "Related Field got invalid
 lookup"):
         Thing.objects.get(tags__foo='bar')
 }}}

 It seems that the regression is introduced by
 
https://github.com/django/django/commit/7aeb7390fc4231119494a9ebdee3c6ee0d5af053
 and is only present on master.

 //Trac ticket related to the commit introducing the regression: //
 https://code.djangoproject.com/ticket/26891

--
Ticket URL: <https://code.djangoproject.com/ticket/27268>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/058.001cc9b8e80a9ebb3342ebde2d604d63%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to