Re: Django session + dynamic form + model form

2011-08-03 Thread voss
Thank you, Tom. You are right! I shouldn't assign choices to a ModelMultipleChoiceField. That's what caused the problem. But instead of constructing a custom ModelMultipleChoiceField subclass, I abandoned "Model Form" and simply did the following, which worked! class myForm(forms.Form):

Re: Django session + dynamic form + model form

2011-08-03 Thread Tom Evans
On Wed, Aug 3, 2011 at 4:57 AM, sasa1...@gmail.com wrote: > Thank you, DR. But I tried that before and it did not work for some reason. > It basically skips "if Answer.is_valid():" and goes to "else". > >    voss > I think this is because you are abusing your model form, and

Re: Django session + dynamic form + model form

2011-08-02 Thread sasa1...@gmail.com
Thank you, DR. But I tried that before and it did not work for some reason. It basically skips "if Answer.is_valid():" and goes to "else". voss You've defined your form to expect a `request` argument, but then you haven't passed that argument. answer = MyForm(request, request.GET or

Re: Django session + dynamic form + model form

2011-08-02 Thread Daniel Roseman
On Tuesday, 2 August 2011 19:15:12 UTC+1, voss wrote: > > Hello all, > > I have a dynamic form as follows: > > class myForm(forms.Form): > Question = > forms.ModelMultipleChoiceField(queryset=Model.objects.none(), > widget=forms.RadioSelect()) > def __init__(self, request, *args,

Django session + dynamic form + model form

2011-08-02 Thread voss
Hello all, I have a dynamic form as follows: class myForm(forms.Form): Question = forms.ModelMultipleChoiceField(queryset=Model.objects.none(), widget=forms.RadioSelect()) def __init__(self, request, *args, **kwargs): super(myForm, self).__init__(*args, **kwargs)