私はジャンゴに新しいですし、カントが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と私の問題への解決策を見つけるように見えます私は、URLのタグが
あるのhrefを使用して藤堂アプリにユーザーをナビゲートしようとしています私は私がやっているかを把握カント
{% 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')
]
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)
間違って、いくつかのガイダンスを高く評価されるでしょう
を使用することができます。 –