summaryrefslogtreecommitdiff
path: root/archaeological_files/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-11-14 18:58:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:19 +0100
commit4746cd2938df3cf87ae338d22eb4f67f35bac960 (patch)
tree1b823f5e78e7214f84da3892e0729c0c2706ad6d /archaeological_files/forms.py
parent2fd7a306df69b723036a94346baa7ea17c9b7364 (diff)
downloadIshtar-4746cd2938df3cf87ae338d22eb4f67f35bac960.tar.bz2
Ishtar-4746cd2938df3cf87ae338d22eb4f67f35bac960.zip
Remove dead code about dashboards
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r--archaeological_files/forms.py51
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 = {