I agree that the typo is also an issue and should be fixed, but that
wouldn't result in the OP's error, since reverse() is complaining about a
'detail' URL specifically. The typo would result in a similar error when
the result page is displayed, and would show 'guestion' as one of the
kwargs.

-James
On May 8, 2015 8:10 PM, "Muhammad M" <mwebbi...@gmail.com> wrote:

> HM,
>
> Upon a closer look at your code (views.results), you have this:
>
> return render(request, 'polls/results.html', {'guestion': question})
>
> You are passing "guestion" (with a G) to the template instead of
> "question" (with a Q).
>
> As such, your template complains when you try to use "question.id"
> because it is expecting "guestion.id" (with a G).
>
> Change it to {'question': question} (with a Q) in views.results and see
> how it goes again.
>
> All the best. :)
>
> Sincerely,
> Muhammad
> On May 8, 2015 10:41 PM, "Luis Zárate" <luisz...@gmail.com> wrote:
>
>> Which urls.py you paste here? The project URLs or the app urls .?
>>
>> It is because you are using namespace in the url reverse so you need to
>> named in your project's URLs and put the code paste here in your app urls.
>>
>> El jueves, 7 de mayo de 2015, James Schneider <jrschneide...@gmail.com>
>> escribió:
>> > I'm guessing the issue is actually in your template if you are
>> following along that page. None of the code in your views would generate
>> that error from what I can see.
>> >
>> > The error indicates that you are trying to reverse('polls:detail') and
>> not providing any arguments for the URL resolver (or are passing an
>> empty/missing variable). In the template, this would probably look
>> something like {% url 'polls:detail' %}. I would guess that you are
>> forgetting question.id after the view name, assuming you are using the
>> same variable names as the tutorial.
>> >
>> > Check near the bottom of the stack trace on the page, I bet it has a {%
>> url %} tag highlighted as the culprit.
>> >
>> > -James
>> >
>> > On May 7, 2015 12:09 AM, "H M" <pressby...@gmail.com> wrote:
>> >>
>> >> I am on part 4 django tutorial. The tutorial is very good and I easily
>> get on part 4 but....
>> >>
>> >> I get error: Reverse for 'detail' with arguments '('',)' and keyword
>> arguments '{}' not found. 1 pattern(s) tried:
>> [u'polls/(?P<question_id>\\d+)/$']
>> >>
>> >> Am I missing something?
>> >>
>> >> My code is following:
>> >>
>> >>> urlpatterns = patterns('',
>> >>>     url(r'^$', views.index, name='index'),
>> >>>     url(r'^(?P<question_id>\d+)/$', views.detail, name='detail'),
>> >>>     url(r'^(?P<question_id>\d+)/results/$',views.results,
>> name='results'),
>> >>>     url(r'^(?P<question_id>\d+)/vote/$', views.vote, name='vote'),
>> >>
>> >>
>> >> views.py:
>> >>
>> >>> 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': "Nijesi izabrao pitanje.",
>> >>>          })
>> >>>     else:
>> >>>         selected_choice.votes += 1
>> >>>         selected_choice.save()
>> >>>         return HttpResponseRedirect(reverse('polls:results', args=(
>> p.id,)))
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to django-users@googlegroups.com.
>> >> Visit this group at http://groups.google.com/group/django-users.
>> >> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/2e2320f1-6813-4e01-8b32-76694dbd22f8%40googlegroups.com
>> .
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUv65UQLmJKjWwySKga08gvAa0OHwkZ39hOj4CjPBS3ww%40mail.gmail.com
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>> --
>> "La utopía sirve para caminar" Fernando Birri
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAG%2B5VyP-vOtdWzW%2BCJj5kFG_XwOFYi-EJfb3Toq31fD%2BKEiGuw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAG%2B5VyP-vOtdWzW%2BCJj5kFG_XwOFYi-EJfb3Toq31fD%2BKEiGuw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJOFuZwHryu87L4zHBfrd73g%3Di_kSZuo0FMfT9TkAdE051hHcA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJOFuZwHryu87L4zHBfrd73g%3Di_kSZuo0FMfT9TkAdE051hHcA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUmsXkp9d-jZf5hycuKPd%3Dk7%2BELtobG10b-bE5SukBppQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to