But after changing to generic views, the method should look like this:
{{{
#!div style="font-size: 80%"
{{{#!python
def vote(request, pk):
p = get_object_or_404(Poll)
...
}}}
}}}
Otherwise the poll application won't work and throws this error:
TypeError at /polls/1/vote/
vote() got an unexpected keyword argument 'pk'
Request Method: POST
Request URL: http://127.0.0.1:8000/polls/1/vote/
Django Version: 1.6.5
Exception Type: TypeError
Exception Value:
vote() got an unexpected keyword argument 'pk'
Python Version: 3.4.1
--
Ticket URL: <https://code.djangoproject.com/ticket/22700>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
I think you made a mistake. The URLconf in the block above still uses
`poll_id` rather than `pk`: `url(r'^(?P<poll_id>\d+)/vote/$', views.vote,
name='vote'),`
--
Ticket URL: <https://code.djangoproject.com/ticket/22700#comment:1>