Hello! I need to write complex form, in that form users can select some params (popup select fields) than fill other fields via ajax query. JS was successfull written and fields are filling well, but when I submit form, validation said something like that: "It's not correct value for this field." Now I try in form init to query list for choices and $('... option').remove(); in JS code, but it's wrong way, because I have to load hole list. How django users solve this problem?
Code example: class TestForm(forms.ModelForm): board = forms.MultipleChoiceField() ... class Meta: ... fields = ('board',) def __init__(self, *args, **kwargs): super(SellUnitForm, self).__init__(*args, **kwargs) self.fields['board'].choices = TypeOfBoard.objects.all().values_list('id', 'name') def save(self, commit=True): # Here is custom save. return super(TestForm, self).save(commit) -- Всего наилучшего! Григорий greg [at] anastasia [dot] ru Письмо отправлено: 2009/11/06 12:20 --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---