django - Invalid block tag: 'request.path', expected 'endblock'

0 votes
15 views
asked Nov 6 by django_learner (116 points)

I am trying to extract current path url using request.path inside python django template i am getting error.

Invalid block tag: 'request.path', expected 'endblock'

I am using it inside javascript like

 "source" : "{% request.path %}"

Is it parsing issue or what ?

1 Answer

0 votes
answered Nov 6 by django_learner (116 points)

Ok i finally found my own answer,

i have to use {{ request.path }} instead of {% request.path %}

The difference between {{ and {% is , {% is used for expression like doing {% if request.path while with my little knowledge {{ is used to pass variable from context/view to template

...