title: Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['app1/(?P<question_id>[0-9]+)/vote/$']
body: <p>Everything worked fine without generic views</p>
  
  <blockquote>
    <p>NoReverseMatch at /app1/2/</p>
  </blockquote>
  
  <pre><code>Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['app1/(?P&lt;question_id&gt;[0-9]+)/vote/$']
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/app1/2/
  Django Version: 1.11.3
  Exception Type: NoReverseMatch
  Exception Value:    
  Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['app1/(?P&lt;question_id&gt;[0-9]+)/vote/$']
  Exception Location: C:\Python36\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 497
  Python Executable:  C:\Python36\python.exe
  Python Version: 3.6.1
  Python Path:    
  ['C:\\Users\\Tomasz\\Desktop\\GitHub\\DjangoTutorialProject',
   'C:\\Python36',
   'C:\\Python36\\python36.zip',
   'C:\\Python36\\DLLs',
   'C:\\Python36\\lib',
   'C:\\Python36\\lib\\site-packages']
  Server time:    Thu, 24 Aug 2017 08:34:58 +0200
  </code></pre>
  
  <p>Error during template rendering</p>
  
  <pre><code>In template C:\Users\Tomasz\Desktop\GitHub\DjangoTutorialProject\app1\templates\app1\detail.html, error at line 5
  
  Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['app1/(?P&lt;question_id&gt;[0-9]+)/vote/$']
  
      1   &lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
      2   
      3   {% if error_message %}&lt;p&gt;&lt;strong&gt;{{ error_message }}&lt;/strong&gt;&lt;/p&gt;{% endif %}
      4   
      5   &lt;form action="{% url 'app1:vote' question.id %}" method="post"&gt;
      6   {% csrf_token %}
      7   {% for choice in question.mychoice_set.all %}
      8       &lt;input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" /&gt;
      9       &lt;label for="choice{{ forloop.counter }}"&gt;{{ choice.choice_text }}&lt;/label&gt;&lt;br /&gt;
      10  {% endfor %}
      11  &lt;input type="submit" value="Vote" /&gt;
      12  &lt;/form&gt;
      13  
  </code></pre>
  
  <p>Problem is this piece of code:</p>
  
  <pre><code>{% url 'app1:vote' question.id %}
  </code></pre>
  
  <p>view</p>
  
  <pre><code>class DetailView(generic.DetailView):
      model = MyQuestion
      template_name = 'app1/detail.html'  
  </code></pre>
  
  <p>urls</p>
  
  <pre><code>from django.conf.urls import url
  
  from . import views
  
  app_name = 'app1'
  urlpatterns = [
      #url(r'^contact/$', views.contact_view, name="contact_view"),
      #url(r'^appinfo/$', views.appinfo_view, name="appinfo_view"),
  
      url(r'^$', views.IndexView.as_view(), name='index'),
      url(r'^(?P&lt;pk&gt;[0-9]+)/$', views.DetailView.as_view(), name='detail'),
      url(r'^(?P&lt;pk&gt;[0-9]+)/results/$', views.ResultsView.as_view(), name='results'),
      url(r'^(?P&lt;question_id&gt;[0-9]+)/vote/$', views.vote, name='vote'),
  ]
  </code></pre>
  
  <p>Template</p>
  
  <pre><code>&lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
  
  {% if error_message %}&lt;p&gt;&lt;strong&gt;{{ error_message }}&lt;/strong&gt;&lt;/p&gt;{% endif %}
  
  &lt;form action="{% url 'app1:vote' question.id %}" method="post"&gt;
  {% csrf_token %}
  {% for choice in question.mychoice_set.all %}
      &lt;input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" /&gt;
      &lt;label for="choice{{ forloop.counter }}"&gt;{{ choice.choice_text }}&lt;/label&gt;&lt;br /&gt;
  {% endfor %}
  &lt;input type="submit" value="Vote" /&gt;
  &lt;/form&gt;
  </code></pre>