#17582: DoesNotExist ambiguous exception when accessed via foreign key
-------------------------------------+-------------------------------------
     Reporter:  simon@…              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  reopened
    Component:  Template system      |                  Version:  1.3
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Design
    Has patch:  0                    |  decision needed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  1                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by systemparadox2):

 * status:  closed => reopened
 * resolution:  needsinfo =>


Comment:

 When accessed via a query, this does indeed give the model name in the
 message (e.g. 'FooBar matching query does not exist').

 However, when accessing a foreign key which either has an invalid value or
 is null, the exception is raised without any message:

 {{{
 .../django/db/models/fields/related.py:301 in __get__
 raise self.field.rel.to.DoesNotExist
 }}}

 This causes the debug page just to show 'DoesNotExist' and 'No exception
 supplied'.

 Since Model.DoesNotExist is created dynamically when the model is loaded,
 surely it would be possible to the name of the model as the default
 message or similar?

 Thanks.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17582#comment:3>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to