Hi,
It looks like you are missing the poll in your context.
{% url 'detail' poll.id %} will try to match an url named detail with the
argument poll.id
However Django says it can't find a reverse for 'detail' with arguments ('',)
which means that you don't have a poll in your context (or the poll.id is
empty).
Double check that you already did the part
https://docs.djangoproject.com/en/1.5/intro/tutorial03/#raising-a-404-error
since the view is there and that there's no typo in the render(..., {'poll':
poll})
Regards,
Xavier,
Linovia.
Le 12 oct. 2013 à 17:12, [email protected] a écrit :
> Hi everyone,
> I'm following the official django tutorials to learn Django by building the
> polls app...
>
> Everything seemed great until chapter 3.
>
> I had this link as part of my index template, which was working fine:
>
> <li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li>
> however, this is hardcoded and the tutorial suggested a better way was to use:
>
> <li><a href="{% url 'detail' poll.id %}">{{ poll.question }}</a></li>
> so that you'll be better of when dealing with huge number of templates and u
> have to make changes to the url.
>
> Since I made the above change I get the following errors when I run the app:
> Exception Type: NoReverseMatch
> Exception Value:
> Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not
> found.
>
> Usually I could easily read where the error is coming from and deal with it
> but in this case I can't spot the cause of the error hence I'm unable to
> progress with my study.
> Any help will be greatly appreciated.
>
>
>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/c33a669a-ff0e-44cf-b95a-93296e71150c%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
--
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 [email protected].
To post to this group, send email to [email protected].
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/5CD1F9A1-E964-47D1-B364-EE778C69E3D7%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.