Here´s part of the code:
field_list = []
date = forms.ChoiceField(label='Wann', required=False,
choices=date_choices_list, widget=forms.Select(attrs={'class':
'vSelectField'}))
field_list.append(('Datum', date))
...
form = CinemaFormDynamic(field_list=field_list)
class CinemaFormDynamic(forms.Form):
def __init__(self, data=None, auto_id=False, field_list=[]):
forms.Form.__init__(self, data, auto_id)
for field in field_list:
self.fields[field[0]] = field[1]
thanks,
patrick
btw: I´m using the current SVN-version and did an update last week
(before the update it worked).
any help with this?
thanks,
patrick
> widget=forms.Select(attrs={'class': 'vSelectField'}))
This let me think you use a javascript validator. Are you sure the
message comes from the server ?
You should try form.is_valid() or whatever.
> just printed "form.is_bound" in my view: the result is "True",
> although I didn´t invoke the Form with any data.
Yes, you bound it with 'data', even if it is None.
You may want to do stuff like :
if data is None:
forms.Form.__init(self, auto_id = auto_id)
else:
forms.Form.__init(self, data, auto_id)
But I'm not sure anyway that forms.Form.__init__(self, ...) is the
right way to do it.
Regards,
Olivier
On Sep 8, 1:31 am, olivier <oliviermig...@gmail.com> wrote:
> Hi,
>
> > widget=forms.Select(attrs={'class': 'vSelectField'}))
>
> This let me think you use a javascript validator. Are you sure the
> message comes from the server ?
> You should try form.is_valid() or whatever.
no javascript. form.is_valid() is not the issue, because I didn´t send
anything.
>
> > just printed "form.is_bound" in my view: the result is "True",
> > although I didn´t invoke the Form with any data.
>
> Yes, you bound it with 'data', even if it is None.
> You may want to do stuff like :
> if data is None:
> forms.Form.__init(self, auto_id = auto_id)
> else:
> forms.Form.__init(self, data, auto_id)
>
> But I'm not sure anyway that forms.Form.__init__(self, ...) is the
> right way to do it.
got the script from on of the django-devs.
thanks,
patrick
>
> Regards,
>
> Olivier