diff options
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r-- | ishtar/furnitures/forms.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index a7f31999e..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") |