diff options
Diffstat (limited to 'archaeological_files/forms.py')
| -rw-r--r-- | archaeological_files/forms.py | 51 | 
1 files changed, 0 insertions, 51 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index eb366b927..a75e5bf34 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -64,7 +64,6 @@ from ishtar_common.forms_common import get_town_field  from archaeological_operations.forms import (      AdministrativeActForm,      AdministrativeActOpeFormSelection, -    SLICING,      AdministrativeActModifForm,      ParcelForm,      ParcelFormSet, @@ -195,56 +194,6 @@ class FileFormMultiSelection(LockForm, MultiSearchForm):      ) -DATE_SOURCE = (("creation", _("Creation date")), ("reception", _("Reception date"))) - - -class DashboardForm(IshtarForm): -    slicing = forms.ChoiceField(label=_("Slicing"), choices=SLICING, required=False) -    department_detail = forms.BooleanField(label=_("Department detail"), required=False) -    date_source = forms.ChoiceField( -        label=_("Date get from"), choices=DATE_SOURCE, required=False -    ) -    file_type = forms.ChoiceField(label=_("File type"), choices=[], required=False) -    saisine_type = forms.ChoiceField( -        label=_("Saisine type"), choices=[], required=False -    ) -    after = forms.DateField(label=_("Date after"), widget=DatePicker, required=False) -    before = forms.DateField(label=_("Date before"), widget=DatePicker, required=False) - -    def __init__(self, *args, **kwargs): -        if "prefix" not in kwargs: -            kwargs["prefix"] = "files" -        super(DashboardForm, self).__init__(*args, **kwargs) -        self.fields["saisine_type"].choices = models.SaisineType.get_types() -        self.fields["file_type"].choices = models.FileType.get_types() - -    def get_show_detail(self): -        return hasattr(self, "cleaned_data") and self.cleaned_data.get( -            "department_detail" -        ) - -    def get_date_source(self): -        date_source = "creation" -        if hasattr(self, "cleaned_data") and self.cleaned_data.get("date_source"): -            date_source = self.cleaned_data["date_source"] -        return date_source - -    def get_filter(self): -        if not hasattr(self, "cleaned_data") or not self.cleaned_data: -            return {} -        date_source = self.get_date_source() -        fltr = {} -        if self.cleaned_data.get("saisine_type"): -            fltr["saisine_type_id"] = self.cleaned_data["saisine_type"] -        if self.cleaned_data.get("file_type"): -            fltr["file_type_id"] = self.cleaned_data["file_type"] -        if self.cleaned_data.get("after"): -            fltr[date_source + "_date__gte"] = self.cleaned_data["after"] -        if self.cleaned_data.get("before"): -            fltr[date_source + "_date__lte"] = self.cleaned_data["before"] -        return fltr - -  class FileFormGeneral(ManageOldType):      form_label = _("General")      associated_models = {  | 
