diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-01-28 04:31:54 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-01-28 04:31:54 +0100 |
commit | 391ec2a2b189609e0bca254adf6106ca9c742c70 (patch) | |
tree | 30fad85dc3f11cdcd11cf1946bec55662bb2016d /ishtar/furnitures/forms.py | |
parent | 2b38ecfdd7b351a61a0f340a2de3e34c04473e52 (diff) | |
download | Ishtar-391ec2a2b189609e0bca254adf6106ca9c742c70.tar.bz2 Ishtar-391ec2a2b189609e0bca254adf6106ca9c742c70.zip |
Implement a file search mecanism (refs #142)
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") |