Hi. Normally, what you are doing would work, initializing the form with request.POST. However the way you have constructed your form, you need have a poll object as well. Not only that but it should of cause be the poll that the post data is associated to. Then you could do it like this form = PollForm(the_right_poll, request.POST)
~Jakob On 18 Apr., 22:27, Adam Yee <[email protected]> wrote: > I've been struggling with dynamically creating and validating forms. > So far I've been able to create the forms using a ModelChoiceField. > > see below - models, forms, views, templatehttp://dpaste.com/hold/35292/ > > After submitting the votes, in the if request.method=="POST" hook, I > can't figure out how to properly fill the form with the request.POST > data. Right now I'm getting this error > > AttributeError at /mediapoll/do_the_poll/ > 'QueryDict' object has no attribute 'choice_set' > > I understand why this is happening, but I can't see if there is > something subtle that I'm missing in creating the form, or how I'm > populating the form with the post data. I'm still fairly new to > Django. Help please, thank you. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

