python - django url error in html href -
I followed the official site Django and now I am developing a new site based on Django.
My schema is:
/ Home / ---- chart
The template in my house has this code:
< For option in code> {% Menu.options%}% lt; Li & gt; & Lt; A href = "{% url option.link%}" & gt; & Lt; I class = '{{option.class}}' & gt; & Lt; //ioption.name}}</a> & Lt; / Li & gt; {% Endfor%}
The menu is a word:
self.menu = {"options": [{"link": "", " "Icon-dashboard", "icon", "class": "icon-dashboard", "{link}": "chart", "name": "chart", "class": "chart: chart"}] < / Code>
But I do not know why this "{% url option.link%}" does not work
Home / urls.py:
url (r '^ $', views.Home.as_view (), name = 'Home'), url (r '^ charts /', included ('charts.urls', namespace = "chart "),
chart / urls.py
url (r '^ $', views.IndexCharts.as_view (), name = 'chart '),
Am I doing well or something is wrong ? If I type hardcod {% url 'chart: chart'%} then it works
error: exception value:
reverse 'for' option.link 'with arguments () And the keyword argument '{}' was not found. 0 pattern (s) tried: []
Sorry about my poor English.
Thocks a lot < / P>
Comments
Post a Comment