I am following a Django tutorial and am stuck with an error in part 4 of the lesson. I got to the part where I am writing a vote that uses the opposite to redirect to another view. For some reason, the reverse failure occurs with the following exception:
import () argument 1 should be a string, not instancemethod
Currently, my urls.py project looks like this:
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^polls/', include('mysite.polls.urls')),
(r'^admin/(.*)', include(admin.site.root)),
)
and urls.py application:
from django.conf.urls.defaults import *
urlpatterns = patterns('mysite.polls.views',
(r'^$', 'index'),
(r'^(?P<poll_id>\d+)/$', 'details'),
(r'^(?P<poll_id>\d+)/results/$', 'results'),
(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
)
And viewing the votes: (I simplified it to only have an error string)
def vote(request, poll_id):
return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(1,)))
When I remove the admin URLs, include urls.py in the project, i.e. turning it into:
urlpatterns = patterns('',
(r'^polls/', include('mysite.polls.urls')),
)
it works.
I have tried so many things and cannot understand what I am doing wrong.