I am trying to build a date-based URL with Django’s url template tag. I have a datetime object that I can display like so:
{{block|date:"F j Y"}}
However, when I use nearly the same syntax with the url templatetag, like so:
{% url meeting block|date:"Y" %}
I get an error — it appears that the only thing passed to url is an empty string:
... Reverse for 'meeting' with arguments '(u'',)' and arguments ...
What might I be doing wrong?
The
urltag is a bit strange, and is very picky about its arguments. In particular, I don’t think it evaluates any filters in its arguments.You could try this: