If no object is returned by get_object_or_404 and get_list_or_404, they
raise an Http404 error for which the error message contains the
{{{model._meta.object_name}}}. This name should not really be shown to the
user within the normal workflow. Classes have a {{{ verbose_name }}} that
is more appropriate.
Moreover, this message should be translatable.
(not sure if it's really a bug or a feature...)
== Code : ==
--
Ticket URL: <https://code.djangoproject.com/ticket/26978>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> == The problem : ==
>
> If no object is returned by get_object_or_404 and get_list_or_404, they
> raise an Http404 error for which the error message contains the
> {{{model._meta.object_name}}}. This name should not really be shown to
> the user within the normal workflow. Classes have a {{{ verbose_name }}}
> that is more appropriate.
>
> Moreover, this message should be translatable.
>
> (not sure if it's really a bug or a feature...)
>
> == Code : ==
>
> https://github.com/django/django/blob/64aba7a8aba06b8be52a1a099b44e1d3be4bdd26/django/shortcuts.py#L93
New description:
== The problem : ==
If no object is returned by get_object_or_404 and get_list_or_404, they
raise an Http404 error for which the error message contains the
{{{model._meta.object_name}}}. This name should not really be shown to the
user within the normal workflow. Classes have a {{{ verbose_name }}} that
is more appropriate.
Moreover, this message should be translatable.
(not sure if it's really a bug report or a feature request...)
== Code : ==
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:1>
* owner: => nobody
* component: Error reporting => Core (Other)
* type: Uncategorized => Cleanup/optimization
Comment:
Is the idea that these messages might be user-facing since #24733?
--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:2>
Comment (by ewjoachim):
I just realized (and tested) that the message of the Http404 was actually
never shown by default. And for #24733, the fact that the view can have
access to the exception does not make its message user facing. If
developers decide to copy exception message to their pages, that's their
responsability.
I might have been a little too fast in opening the ticket. Sorry for the
noise.
--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:3>
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:4>