Reputation: 2159
In django I want to do something like this, which will pass current year to url name
{% with now "Y" as year %}
<a href="{% url 'createAwardWinner' year %}"><i class="fa fa-gavel fa-fw"></i> Create</a>
{% endwith %}
but its not able to interpret I want to do
year = now 'Y'
How should I do this
Upvotes: 1
Views: 238
Reputation: 1145
Did you simply try:
{% now "Y" as current_year %}
<a href="{% url 'createAwardWinner' current_year %}"><i class="fa fa-gavel fa-fw"></i> Create</a>
Upvotes: 4