On 1/22/07, Andy Dustman <[EMAIL PROTECTED]> wrote: > On 1/22/07, Bo Shi <[EMAIL PROTECTED]> wrote: > > > > I think request.META is what you're looking for, i.e.: > > > > referrer = request.META.get('HTTP_REFERER', '/') > > I know that; I need to have access to it from a template, specifically > my 404.html template, in a way that will work with generic views or > get_object_or_404(). Unfortunately the 404 handler does not pass any > of that stuff to the template as far as I can tell.
Here's how I made it work: Index: django/views/defaults.py =================================================================== --- django/views/defaults.py (revision 4391) +++ django/views/defaults.py (working copy) @@ -76,7 +76,7 @@ The path of the requested URL (e.g., '/app/pages/bad_page/') """ t = loader.get_template(template_name) - return http.HttpResponseNotFound(t.render(RequestContext(request, {'request_path': request.path}))) + return http.HttpResponseNotFound(t.render(RequestContext(request, {'request_path': request.path, 'META': request.META}))) def server_error(request, template_name='500.html'): """ I'd be happy to add a ticket for this; I think it's unlikely this would cause any problem. -- Patriotism means to stand by the country. It does not mean to stand by the president. -- T. Roosevelt This message has been scanned for memes and dangerous content by MindScanner, and is believed to be unclean. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---