[Answer]-Access URL parameters in django 1.7 template without using context processors

1👍

The following will actually work…

{{ request.GET.param1 }}

… as long as you have the default django.template.context_processors.request enabled in your settings file.

DJANGO_CONTEXT_PROCESSORS = (
    # ...any other context processors you want to run
    'django.core.context_processors.request',
)

All this it does is place the request object in your template context, which you can then use to access url parameters. It’s exactly the functionality you’re looking for. See here.

Your only other option is to pass the parameter to the template explicitly, as you describe in your question.

👤tino

0👍

You can try using custom tags in django templates.

Leave a comment