Saturday, January 26, 2013

poll tutorial 4

Hi all,

I have encountered following error in the django tutorial. It is a reverse function error and the problematic line:

return HttpResponseRedirect(reverse('polls.views.results', args=(p.id,)))

In the "vote" view, I choose one of the choices, and click the vote button. Instead of "results" view, I face this error. ("results" view works, and the scores of the choices are also correct.)

My tree:

.
├── databaseim.db
├── manage.py
├── polls
│   ├── admin.py
│   ├── admin.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── urls.py
│   ├── urls.pyc
│   ├── views.py
│   └── views.pyc
└── proje1
    ├── __init__.py
    ├── __init__.pyc
    ├── settings.py
    ├── settings.pyc
    ├── templatelerim
    │   ├── admin
    │   │   └── base_site.html
    │   └── polls
    │       ├── detail.html
    │       ├── index.html
    │       └── results.html
    ├── urls.py
    ├── urls.pyc
    ├── wsgi.py
    └── wsgi.pyc

--


Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/polls/1/vote/

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'polls')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/mehmet/internet_projeleri/proje1/polls/views.py" in vote
  55.         return HttpResponseRedirect(reverse('polls.views.results', args=(p.id,)))
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in reverse
  476.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in _reverse_with_prefix
  396.                 "arguments '%s' not found." % (lookup_view_s, args, kwargs))

Exception Type: NoReverseMatch at /polls/1/vote/
Exception Value: Reverse for 'polls.views.results' with arguments '(1,)' and keyword arguments '{}' not found.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment