Django

Code

Changeset 4756

Show
Ignore:
Timestamp:
03/20/07 11:48:41 (2 years ago)
Author:
adrian
Message:

Fixed #3767 -- Added reason to Http404 exception raised in get_object_or_404 and get_list_or_404

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/shortcuts/__init__.py

    r4275 r4756  
    2020        return manager.get(*args, **kwargs) 
    2121    except klass.DoesNotExist: 
    22         raise Http404 
     22        raise Http404('No %s matches the given query.' % klass._meta.object_name) 
    2323 
    2424def get_list_or_404(klass, *args, **kwargs): 
     
    2929    obj_list = list(manager.filter(*args, **kwargs)) 
    3030    if not obj_list: 
    31         raise Http404 
     31        raise Http404('No %s matches the given query.' % manager.model._meta.object_name) 
    3232    return obj_list