Skip to content
Advertisement

Django How to get GET parameters in template


I’m working on a django project.
I’m wondering how to get GET parameters in template so that I can make corresponding tab active.
I tried the code below, but it didn’t work.
JavaScript

Thank you in advance.

Advertisement

Answer

Get it in view and send it as parameter in render

JavaScript

and use it in template

JavaScript

Or get it as

JavaScript

and set in template without if

JavaScript

BTW:

You could get it also as

JavaScript

and use it in template to set class and to display query

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement