Martin
Martin

Reputation: 4330

Django admin template: Accessing request object in template

I need the request object in all admin templates. In frontend templates, I can achieve this by rendering the template with RequestContext:

return render_to_response('my_template.html',
    my_data_dictionary,
    context_instance=RequestContext(request)
)

With that, I can access the request object in frontend:

{{ request.path }}

How can I do this for all admin views in Django 1.2?

Upvotes: 5

Views: 2317

Answers (1)

Timmy O'Mahony
Timmy O'Mahony

Reputation: 53971

The request should be available in the admin templates if you have 'django.core.context_processors.request' added to your TEMPLATE_CONTEXT_PROCESSORS in your settings.py

Upvotes: 8

Related Questions