summaryrefslogtreecommitdiff
path: root/archaeological_files/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r--archaeological_files/forms.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 4364829b2..d2e31d80c 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -42,7 +42,7 @@ from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \
from ishtar_common.forms_common import get_town_field, get_person_field
from archaeological_operations.forms import AdministrativeActOpeForm, \
AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm, \
- ParcelField
+ ParcelField, SLICING
from ishtar_common import widgets
GENERAL_CONTRACTOR, created = PersonType.objects.get_or_create(
@@ -122,29 +122,36 @@ class FileFormSelection(forms.Form):
raise forms.ValidationError(_(u"You should select a file."))
return cleaned_data
-SLICING = (('year',_(u"years")), ("month",_(u"months")))
DATE_SOURCE = (('creation',_(u"Creation date")),
("reception",_(u"Reception date")))
class DashboardForm(forms.Form):
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=_(u"Creation date after"),
+ after = forms.DateField(label=_(u"Date after"),
widget=widgets.JQueryDate, required=False)
- before = forms.DateField(label=_(u"Creation date before"),
+ before = forms.DateField(label=_(u"Date before"),
widget=widgets.JQueryDate, 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 \