diff options
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r-- | ishtar/furnitures/forms.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index 82bfcb88e..c49367ab4 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -652,7 +652,31 @@ class FileWizard(Wizard): parcel.save() return res +class FileSelect(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)]) + file_type = forms.ChoiceField(label=_("File type"), + choices=models.FileType.get_types()) + year = forms.IntegerField(label=_("Year")) + +class FileFormSelection(forms.Form): + form_label = _("Archaelogical file") + associated_models = {'pk':models.File} + currents = {'pk':models.File} + pk = forms.IntegerField(label="", required=False, + widget=widgets.JQueryJqGrid(reverse_lazy('json-file'), + FileSelect(), ['file_type', 'year']), + validators=[models.valid_id(models.File)]) + + 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 a file.")) + return cleaned_data +""" class FileFormSelection(forms.Form): form_label = _("Archaelogical file") associated_models = {'pk':models.File} @@ -661,6 +685,7 @@ class FileFormSelection(forms.Form): widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-file'), associated_model=models.File), validators=[models.valid_id(models.File)]) +""" class FileFormGeneral(forms.Form): form_label = _("General") @@ -1066,15 +1091,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="", 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") |