diff options
Diffstat (limited to 'ishtar/furnitures/forms.py')
| -rw-r--r-- | ishtar/furnitures/forms.py | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index 769e5d509..467d2b342 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -117,6 +117,19 @@ class FormSet(BaseFormSet):          form.fields[DELETION_FIELD_NAME].label = ''          form.fields[DELETION_FIELD_NAME].widget = widgets.DeleteWidget() +class SearchWizard(NamedUrlSessionFormWizard): +    model = None + +    def get_wizard_name(self): +        """ +        As the class name can interfere when reused, use the url_name +        """ +        return self.url_name + +    def get_template(self, request, storage): +        templates = ['search.html'] +        return templates +  class Wizard(NamedUrlSessionFormWizard):      model = None @@ -1048,6 +1061,9 @@ def is_preventive(form_name, model, type_key='file_type', key=''):              return False      return func +file_search_wizard = SearchWizard([('general-file_search', FileFormSelection)], +                            url_name='file_search',) +  file_creation_wizard = FileWizard([                              ('general-file_creation', FileFormGeneral),                              ('address-file_creation', FileFormAddress), @@ -1627,6 +1643,10 @@ PeriodFormset = formset_factory(PeriodForm, can_delete=True,                                  formset=PeriodFormSet)  PeriodFormset.form_label = _("Periods") +operation_search_wizard = SearchWizard([ +                          ('general-operation_search', OperationFormSelection)], +                          url_name='operation_search',) +  operation_creation_wizard = OperationWizard([             ('general-operation_creation', OperationFormGeneral),             ('refs-operation_creation', OperationFormReference), @@ -1893,6 +1913,10 @@ class RecordFormInterpretation(forms.Form):      tpq_estimated = forms.IntegerField(label=_(u"Estimated TPQ"),                                         required=False) +record_search_wizard = SearchWizard([ +                          ('general-record_search', RecordFormSelection)], +                          url_name='record_search',) +  record_creation_wizard = RecordWizard([      ('selec-record_creation', OperationFormSelection),      ('general-record_creation', RecordFormGeneral), @@ -2005,6 +2029,10 @@ class ItemFormSelection(forms.Form):                                     ItemSelect(), models.Item),         validators=[models.valid_id(models.Item)]) +item_search_wizard = SearchWizard([ +                          ('general-item_search', ItemFormSelection)], +                          url_name='item_search',) +  item_modification_wizard = ItemWizard([      ('selec-item_modification', ItemFormSelection),      ('item-item_modification', ItemForm), | 
