summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-12-19 19:36:48 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-12-19 19:36:48 +0100
commit04538afd95d91bf7829bf24a2d8f9fb023f6b18d (patch)
tree8eca20c57497832211c915d412ead0614389918a
parent1507fa4088ef3837f73ff041657f1bc3e9f9c968 (diff)
downloadIshtar-04538afd95d91bf7829bf24a2d8f9fb023f6b18d.tar.bz2
Ishtar-04538afd95d91bf7829bf24a2d8f9fb023f6b18d.zip
Improve administrative act (files) search (refs #1533)
-rw-r--r--archaeological_files/forms.py31
-rw-r--r--archaeological_files/views.py12
2 files changed, 42 insertions, 1 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 17b918ca9..bf05c996d 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -222,6 +222,37 @@ class DocumentGenerationAdminActForm(forms.Form):
class AdministrativeActFileSelect(TableSelect):
associated_file__towns = get_town_field()
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
+ signature_date_after = forms.DateField(label=_(u"Signature date after"),
+ widget=widgets.JQueryDate)
+ signature_date_before = forms.DateField(label=_(u"Signature date before"),
+ widget=widgets.JQueryDate)
+ associated_file__general_contractor = forms.IntegerField(
+ label=_(u"General contractor"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person',
+ args=[PersonType.objects.get(txt_idx='general_contractor').pk]),
+ associated_model=Person),
+ validators=[valid_id(Person)])
+ associated_file__general_contractor__attached_to = forms.IntegerField(
+ label=_(u"Organization of general contractor"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-organization',
+ args=[OrganizationType.objects.get(
+ txt_idx='general_contractor').pk]),
+ associated_model=Organization),
+ validators=[valid_id(Organization)])
+ associated_file__numeric_reference = forms.IntegerField(
+ label=_("Numeric reference"))
+ associated_file__year = forms.IntegerField(label=_("Year"))
+ associated_file__internal_reference = forms.CharField(max_length=200,
+ label=_("Other reference"))
+ associated_file__in_charge = forms.IntegerField(
+ label=_(u"In charge"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person',
+ args=[PersonType.objects.get(txt_idx='sra_agent').pk]),
+ associated_model=Person),
+ validators=[valid_id(Person)])
def __init__(self, *args, **kwargs):
super(AdministrativeActFileSelect, self).__init__(*args, **kwargs)
diff --git a/archaeological_files/views.py b/archaeological_files/views.py
index 8fcde9ea0..9a866c311 100644
--- a/archaeological_files/views.py
+++ b/archaeological_files/views.py
@@ -25,11 +25,15 @@ from django.shortcuts import render_to_response
from django.utils.translation import ugettext_lazy as _
from ishtar_common.views import get_item, show_item, revert_item
+
+from ishtar_common.models import Person
from archaeological_operations.models import AdministrativeAct
import models
+
from ishtar_common.wizards import SearchWizard
from archaeological_operations.wizards import is_preventive
from wizards import *
+
from ishtar_common.forms_common import TownFormset
from archaeological_operations.forms import ParcelFormSet
from forms import *
@@ -74,9 +78,15 @@ revert_file = revert_item(models.File)
get_administrativeactfile = get_item(AdministrativeAct,
'get_administrativeactfile', 'administrativeactfile',
+ associated_models = [(models.File, 'associated_file'),
+ (Person, 'associated_file__general_contractor')],
+ dated_fields = ['signature_date__lte', 'signature_date__gte'],
extra_request_keys={'associated_file__towns':'associated_file__towns__pk',
'operation__towns':'operation__towns__pk',
- 'act_type__intented_to':'act_type__intented_to'})
+ 'act_type__intented_to':'act_type__intented_to',
+ 'signature_date_before':'signature_date__lte',
+ 'signature_date_after':'signature_date__gte',
+ })
def dashboard_file(request, *args, **kwargs):
"""