Opened 16 years ago
Closed 16 years ago
#10987 closed (invalid)
[patch] generic object_detail support for custom 404 page
| Reported by: | Maxim Ivanov | Owned by: | nobody |
|---|---|---|---|
| Component: | Generic views | Version: | 1.1-beta |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
It's handy to have custom 404 page for generic object_detail view. Such as "Sorry man, post not found". Here is a simple patch which adds handler404 keyword arg which should point to django template file.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
It can be done with
from django.views.default import page_not_found def my_view(request, *args, **kwargs): try: return object_detail(request, *args, **kwargs) except Http404: return page_not_found(request, template_name='my_404.html')for e.g.
Which is less implicit and more versatile way.