URL pattern declaration from views.py
url(r'^intentions/(\d+)/$', 'intentions.views.show'),
When I am writing address directly, like intentions/1 works ok, but when I trying to display URL show for object like:
{% for i in intentions %}
{% url 'intentions.views.show' i.id as iUrl %}
<li><a href="{{ iUrl }}">{{ i }}</a></li>
{% endfor %}
I am ending with empty href. Could someone give me any advice?
If you are using Django 1.3 or 1.4, make sure you are loading the new url tag. Add the following line to the top of your template:
If you are using Django 1.4 or earlier, and you haven’t loaded the new url tag as above, then you need to remove the single quotes from the url pattern:
As an aside, it’s recommended to name your url pattern:
Then change your template to: