3

In one of my django login templates, I have a line:

<input type="hidden" name="next" value="{{ next|default:'{% url jobseeker_home %}' }}" />

And when I view the source code of the HTML page generated, I get the following for the above template line:

<input type="hidden" name="next" value="{% url jobseeker_home %}" />

Unfortunately, the {% url jobseeker_home %} is not being resolved. How can I solve this?

Thanks

1 Answer 1

9

Variables can be declared within a Django template:

{% url jobseeker_home as home_url %}
<input type="hidden" name="next" value="{{ next|default:home_url }}" />
Sign up to request clarification or add additional context in comments.

2 Comments

awesome. I didn't know you could do that!
@Jerzyk: yes, I changed the variable name halfway through but didn't finish the job. Fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.