Hi all

I'm having problems in getting Part 4 of the tutorial where one uses
generic views to work. The Polls app works fine until then. I have made
the changes in part  4 and the polls/ URL is fine and when I go to say
polls/1/ I get my list of polls with the Vote button but when its
clicked I get:

TypeError at /polls/1/vote/
vote() got an unexpected keyword argument 'poll_id'
Exception Type:         TypeError
Exception Value:        vote() got an unexpected keyword argument 'poll_id'

I suspect the error is in either views.py maybe. I wasn't exactly sure
how far to replace poll  with object. I have this:

def vote(request, object_id):
    p=get_object_or_404(Poll, pk=object_id)
    try:
        selected_choice = p.choice_set.get(pk=request.POST['choice'])
    except (KeyError, Choice.DoesNotExist):
        return render_to_response('polls/poll_detail.html',
             {'object': p, 'error_message': "You didn't select a choice."})
    else:
        selected_choice.votes += 1
        selected_choice.save()
        return HttpResponseRedirect('/polls/%s/results' % p.id)


What would be nice is a fully completed Part 4 set of files to comapre
against.

Regards
Mike


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to