내가 장고에 새로운 오전 캔트NoReverseMatch 오류 장고 1.10
나는 다음과 같은 오류를 얻을
Reverse for 'todo_list' with arguments '()' and keyword arguments
'{'cid': 1}' not found. 1 pattern(s) tried: ['todo/(?P<cid>)/']
1 {% extends "base.html" %}
2 {% block nav_title %} Company Batches {% endblock nav_title %}
3 {% block content %}
4 <div class="jumbotron">
5
6 {% for obj in object_list %}
7 <a href={% url 'todo_list' cid=obj.company.id%} class="href-nostyle">
8 <div class="container">
9 <div class="jumbotron" style="background:white">
10 <div class="text-center">
11 <h1>{{ obj.company }}<br>
12 <small>{{ obj.job }}</small>
13 </h1>
14 </div>
15 </div>
16 </div>
17 </a>
이 템플릿의 이름은 응용 프로그램에 있습니다 company_batches 내 문제에 대한 해결책을 찾을 수가 내가 HREF
내 URL 태그를 사용하여 할 일 응용 프로그램에 사용자를 탐색을 시도하고하는 것은
입니다 17,451,515,{% url 'todo_list' cid=obj.company.id%}
내 주요 urls.py
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', home, name='home'),
url(r'^batches/', include('company_batches.urls')),
url(r'^todo/', include('todo.urls'), name='todo')
]
할 일/urls.py
urlpatterns = [
url(r'^$', ToDoCreateView.as_view(), name='todo_create'),
url(r'^(?P<cid>)/', ToDoListView.as_view(), name='todo_list'),
]
관련 views.py 내가 뭘하는지 파악하지 못할
class ToDoListView(ListView,):
template_name = 'todo/todo_list.html'
def get_context_data(self, *args, **kwargs):
context = super(ToDoListView, self).get_context_data(*args, **kwargs)
return context
def get_queryset(self, cid):
return ToDoList.objects.filter(company=self.cid)
틀린, 약간의 안내는 많이 감사하게 될 것이다
을 사용할 수 있습니다. –