내 URL은 다음 캡처 할 필요가 없습니다 :장고 : 여러 매개 변수에 역의 URL 경기는
domain/forum-name/
domain/forum-name/topic-name
I가 다음 URL 정의 : I 도메인/이름과 같은 URL을 명중
url(r'^$', views.index_forums, name='index_forums'),
url(r'^(?P<forum_name>[-\w]+)/(?P<topic_name>[-\w]+)/$', views.show_topic, name='show_topic'),
url(r'^(?P<forum_name>[-\w]+)/$', views.index_topics, name='index_topics'),
-of-forum, 나는 HTML에서 URL을 다음과 같이 생성한다 :
{% url 'board:show_topic' forum_name|lower topic.title|lower %}
이렇게하면 "Reverse ... not found"오류가 나타나며 figu 이유를 되 찾으십시오. "url"을 잘못 사용하고 있습니까? 정규 표현식에 문제가 있습니까? 감사!
편집 : 전체 오류 및 템플릿을 추가 :
NoReverseMatch at /random/
Reverse for 'show_topic' with arguments '(u'random', u'funny youtube videos')' and keyword arguments '{}' not found.
Request Method: GET
Request URL: http://localhost:8000/random/
Django Version: 1.5c2
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'show_topic' with arguments '(u'random', u'funny youtube videos')' and keyword arguments '{}' not found.
Exception Location: /Users/travis/code/penv/lib/python2.7/site- packages/django/template/defaulttags.py in render, line 424
Python Executable: /Users/travis/code/penv/bin/python
Python Version: 2.7.2
Reverse for 'show_topic' with arguments '(u'random', u'funny youtube videos')' and keyword arguments '{}' not found.
1 {% extends "board/base.html" %}
2
3 {% block content %}
4 {% if topic_list %}
5 <ul>
6 {% for topic in topic_list %}
7 <li><a href="{% url 'board:show_topic' forum_name|lower topic.title|lower %}">{{topic.title}}</a></li>
8 {% endfor %}
9 </ul>
10 {% else %}
11 <p>No topics! <a href="/topic/new/">Make a new one</a>.</p>
12 {% endif %}
13 {% endblock %}
전체 오류 텍스트를 게시 할 수 있습니까? – czarchaic
보기를 게시 할 수 있습니까? –
원래 게시물에 추가 – c4am95