python - django url error in html href -
i followed official site django , i'm developing new site based in django.
my schema is:
/home /----charts
my home template have code:
{% alternative in menu.options %} <li ><a href="{% url option.link %}"><i class='{{ option.class }}'></i><span></span>{{option.name}}</a> </li> {% endfor %}
menu dict:
self.menu = { "options": [ { "link": "", "name": "home", "class": "icon-dashboard", }, { "link": "charts:charts", "name": "charts", "class": "icon-bar-chart", } ]
but don't know why didn't work " {% url option.link %} "
home/urls.py:
url(r'^$', views.home.as_view(), name='home'), url(r'^charts/', include('charts.urls',namespace="charts")),
charts/urls.py
url(r'^$', views.indexcharts.as_view(), name='charts'),
i'm doing or wrong? if type hardcode {% url 'charts:charts' %} works.
the error is: exception value: reverse 'option.link' arguments '()' , keyword arguments '{}' not found. 0 pattern(s) tried: []
sorry poor english.
thx lot.
python django url href
No comments:
Post a Comment