Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3767 -- Added reason to Http404 exception raised in get_object…

…_or_404 and get_list_or_404

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6cc0eda1cb665e680ae29307a72c7cea1926cb52 1 parent 55a67ae
@adrianholovaty adrianholovaty authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/shortcuts/
4 django/shortcuts/
@@ -19,7 +19,7 @@ def get_object_or_404(klass, *args, **kwargs):
return manager.get(*args, **kwargs)
except klass.DoesNotExist:
- raise Http404
+ raise Http404('No %s matches the given query.' % klass._meta.object_name)
def get_list_or_404(klass, *args, **kwargs):
if isinstance(klass, Manager):
@@ -28,5 +28,5 @@ def get_list_or_404(klass, *args, **kwargs):
manager = klass._default_manager
obj_list = list(manager.filter(*args, **kwargs))
if not obj_list:
- raise Http404
+ raise Http404('No %s matches the given query.' % manager.model._meta.object_name)
return obj_list
Please sign in to comment.
Something went wrong with that request. Please try again.