mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Fixed #3767 -- Added reason to Http404 exception raised in get_object_or_404 and get_list_or_404
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -19,7 +19,7 @@ def get_object_or_404(klass, *args, **kwargs): | ||||
|     try: | ||||
|         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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user