开发者

NoReverseMatch with Django-survey?

开发者 https://www.devze.com 2023-03-11 08:19 出处:网络
Ok, so this works in my urls.py: url(r\'^\', survey_detail, {\'survey_slug\':\'my-survey\'},name=\'survey-detail\'),

Ok, so this works in my urls.py:

url(r'^', survey_detail, {'survey_slug':'my-survey'},  name='survey-detail'),

I removed the above line and want to put the link in a template using {% url %}

I have the following line in urls.py:

url(r'^survey/', include('survey.urls'),

This is the line from the urls.py of the Survey app:

url(r'^detail/(?P<survey_slug>[-\w]+)/$', survey_detail,   name='开发者_如何转开发survey-detail'),

And this in my template:

{% url survey_detail 'my-survey' %}

I have also tried:

{% url survey_detail survey_slug='my-survey' %}

But I always get:

Reverse for 'survey_detail' with arguments '(u'my-survey',)' and keyword arguments '{}' not found.

or

Reverse for 'survey_detail' with arguments '()' and keyword arguments '{'survey_slug': u'my-survey'}' not found.

Any ideas?


The name is survey-detail and not survey_detail

0

精彩评论

暂无评论...
验证码 换一张
取 消