On Tue, Apr 22, 2014 at 8:10 AM, Okabe Kenji <hiperkent@gmail.com> wrote:
>
> At the end of tutorial part 4, I got following error message and could not get displayed the result page.
> Request Method: GET
> Request URL: http://127.0.0.1:8000/polls/1/result/
> Django Version: 1.3.1
Django 1.3 is ancient, unsupported and full of security holes.
Unsupported means that you shouldn't expect a lot of help with it,
particularly as this is a tutorial you are running through, not a
pre-existing project with lots of 1.3-era code.
> Exception Type: TypeError
> Exception Value:
>
> object_list() got an unexpected keyword argument 'object_id'
>
> Exception Location: /usr/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response, line 111
>
> Here is the copy of each related codes.
>
> results.html:
> <h1>{{ object.question }}</h1>
> <ul>
> {% for choice in object.choice_set.all %}
> <li>{{choice.choice }} -- {{ choice.votes }} Hyou</li>
> {% endfor %}
> </ul>
>
> urls.py:
> urlpatterns = patterns('',
> (r'^$', 'django.views.generic.list_detail.object_list', info_dict),
> (r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict),
> url(r'^(?P<object_id>\d+)/result/$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name='pol
> (r'^(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
So, looking at the tutorial for Django 1.3, this code does not appear
at all. The tutorial for Django 1.3 tells you about DetailView and
ListView in the "generics" section of the tutorial. This code in fact
comes from the tutorial for Django 1.2.
Mixing the tutorial for Django 1.2 with the code from Django 1.3 is
not going to work well.
My advice: start again from scratch. Install the latest release of
django, that is Django 1.6.3, and follow the Django 1.6 tutorial.
Cheers
Tom
--
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/CAFHbX1KvDES43tnt8xtuXJojgReDGd3FJct0%3DTMPkekNBh130A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment