diff --git a/django/views/generic/list_detail.py b/django/views/generic/list_detail.py
index 27e36bd..07321d4 100644
a
|
b
|
def object_detail(request, queryset, object_id=None, slug=None,
|
104 | 104 | slug_field='slug', template_name=None, template_name_field=None, |
105 | 105 | template_loader=loader, extra_context=None, |
106 | 106 | context_processors=None, template_object_name='object', |
107 | | mimetype=None): |
| 107 | mimetype=None, handler404=None): |
108 | 108 | """ |
109 | 109 | Generic detail of an object. |
110 | 110 | |
… |
… |
def object_detail(request, queryset, object_id=None, slug=None,
|
124 | 124 | try: |
125 | 125 | obj = queryset.get() |
126 | 126 | except ObjectDoesNotExist: |
127 | | raise Http404, "No %s found matching the query" % (model._meta.verbose_name) |
| 127 | if handler404: |
| 128 | t = template_loader.get_template(handler404) |
| 129 | c = RequestContext(request) |
| 130 | return HttpResponse(t.render(c), status=404, mimetype=mimetype) |
| 131 | else: |
| 132 | raise Http404, "No %s found matching the query" % (model._meta.verbose_name) |
128 | 133 | if not template_name: |
129 | 134 | template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) |
130 | 135 | if template_name_field: |
diff --git a/docs/ref/generic-views.txt b/docs/ref/generic-views.txt
index 427ef91..a0e2de5 100644
a
|
b
|
A page representing an individual object.
|
877 | 877 | * mimetype: The MIME type to use for the resulting document. Defaults |
878 | 878 | to the value of the DEFAULT_CONTENT_TYPE setting. |
879 | 879 | |
| 880 | * handler404: The full name of a template to use in rendering the |
| 881 | 404 error page if object does not exist. This lets you use custom error |
| 882 | page for this type of objects. If handler404 isn't specified, this view |
| 883 | will raise Http404 exception and standart 404 error page will be shown to user. |
| 884 | |
880 | 885 | **Template name:** |
881 | 886 | |
882 | 887 | If template_name isn't specified, this view will use the template |