You don't. The default 404 handler serves up a template and passes it
the request path, that is all.
If you want a more customised look, then don't raise the Http404
exception, but rather return a HttpResponseNotFound(), containing
whatever template you like. This might mean you have to catch the
Http404 exception at some point in your view code if it's raised from
the internals and return the right response, rather than letting it go
through to the default handler.
Regards,
Malcolm
I was gonna say look at the default 404 template. But, in my django
(newforms admin branch) /django/contrib/admin/templates/admin/404.html
there is no template var used :(
Checking docs
http://www.djangoproject.com/documentation/request_response/#the-http404-exception
I find no answer :(
Digging through the code I eventually found
c = Context({
'root_urlconf': settings.ROOT_URLCONF,
'request_path': request.path[1:], # Trim leading slash
'urlpatterns': tried,
'reason': str(exception),
'request': request,
'request_protocol': request.is_secure() and "https" or "http",
'settings': get_safe_settings(),
})
So, it looks like "reason" is the template var you want.
--
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___________________________________________________________________________
You've got fun! Check out Austin360.com for all the entertainment
info you need to live it up in the big city!