Saturday, October 12, 2013

Re: Official Django tutorial 3: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found.

thanks Xavier,

the problem was that I mistyped poll.id as poll_id and now it works fine.

Thanks again for your input.

Regards,
Max

On Saturday, October 12, 2013 11:30:53 AM UTC-7, Xavier Ordoquy wrote:
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, dvg...@gmail.com 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 django-users...@googlegroups.com.
To post to this group, send email to django...@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/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 django-users+unsubscribe@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/b0ebeeae-7d93-4dce-bdc3-a90eb10da7fb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate