diff options
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r-- | ishtar/furnitures/forms.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index 82bfcb88e..2725815b4 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -1066,15 +1066,36 @@ class OperationWizard(Wizard): + datas return datas +class OperationSelect(forms.Form): + town = forms.IntegerField(label=_(u"Town"), + widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \ + 'autocomplete-town', associated_model=models.Town), + validators=[models.valid_id(models.Town)]) + operation_type = forms.ChoiceField(label=_("Operation type"), + choices=models.OperationType.get_types()) + year = forms.IntegerField(label=_("Year")) + class OperationFormSelection(forms.Form): form_label = _("Operation") associated_models = {'pk':models.Operation} currents = {'pk':models.Operation} + pk = forms.IntegerField(label=_("Operation"), required=False, + widget=widgets.JQueryJqGrid(reverse_lazy('json-operation'), + OperationSelect(), ['operation_type', 'year']), + validators=[models.valid_id(models.Operation)]) + + def clean(self): + cleaned_data = self.cleaned_data + if 'pk' not in cleaned_data or not cleaned_data['pk']: + raise forms.ValidationError(_(u"You should select an operation.")) + return cleaned_data + + """ pk = forms.IntegerField(label=_("Operation"), widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-operation'), associated_model=models.Operation), validators=[models.valid_id(models.Operation)]) - +""" class OperationFormGeneral(forms.Form): form_label = _("General") |