title: Do I need render(request...) or HttpResponseRedirect(reverse...) in djangoproject tutorial 4
body: <p>In djangoproject tutorial part 4 i get following error:</p>
  
  <blockquote>
    <p>NoReverseMatch at /polls/1/results/
    Reverse for 'detail' with arguments '('',)' and keyword arguments '{}'
    not found. 1 pattern(s) tried: [u'polls/(?P\d+)/$']</p>
  </blockquote>
  
  <pre><code>1   &lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
  2   
  3   &lt;ul&gt;
  4   {% for choice in question.choice_set.all %}
  5       &lt;li&gt;{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}&lt;/li&gt;
  6   {% endfor %}
  7   &lt;/ul&gt;
  8   
  9   &lt;a href="{% url 'polls:detail' question.id %}"&gt;Vote again?&lt;/a&gt;
  10  
  </code></pre>
  
  <p>It seems that I wrote exactly what is in tutorial, does anyone have a clue what could be wrong?</p>
  
  <p>I tried other approaches from stackedoverflow like:
  <a href="https://stackoverflow.com/questions/28395642/django-1-7-4-error-on-django-1-7-tutorial04-noreversematch-error-for-reverse-f">Django 1.7.4: Error on Django 1.7 tutorial04: NoReverseMatch error for Reverse for &#39;vote&#39;</a></p>
  
  <p><a href="http://djangotalk.blogspot.com/2014/12/re-reverse-for-results-with-arguments_2.html" rel="nofollow noreferrer">http://djangotalk.blogspot.com/2014/12/re-reverse-for-results-with-arguments_2.html</a></p>
  
  <p>but all those errors could point to different things</p>
  
  <p>My code is following:</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^$', views.index, name='index'),
      url(r'^(?P&lt;question_id&gt;\d+)/$', views.detail, name='detail'),
      url(r'^(?P&lt;question_id&gt;\d+)/results/$',views.results, name='results'),
      url(r'^(?P&lt;question_id&gt;\d+)/vote/$', views.vote, name='vote'),
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import get_object_or_404, render
  from django.http import HttpResponseRedirect, HttpResponse
  from django.template import RequestContext, loader
  from polls.models import Question, Choice
  from django.http import Http404
  from django.core.urlresolvers import reverse
  
  
  def index(request):
      latest_question_list =  Question.objects.order_by('-pub_date')[:5]
      template = loader.get_template('polls/index.html')
      context = RequestContext(request, {'latest_question_list' : latest_question_list, })
      return HttpResponse(template.render(context))
  
  def detail(request, question_id):
      try:
          question = Question.objects.get(pk = question_id)
      except Question.DoesNotExist:
          raise Http404("Question ne postoji")
      return render(request, 'polls/detail.html', {'question': question})
  
  def results(request, question_id):
      question = get_object_or_404(Question, pk = question_id)
      return render(request, 'polls/results.html', {'guestion': question})
  
  
  def vote(request, question_id):
      p = get_object_or_404(Question, pk=question_id)
      try:
          selected_choice  = p.choice_set.get(pk=request.POST['choice'])
      except (KeyError, Choice.DoesNotExist):
          return render(request, 'polls/detail.html', {
              'question': p,
              'error_message': "Did not choose answer.",
           })
      else:
          selected_choice.votes += 1
          selected_choice.save()
          return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))
  </code></pre>