diff options
-rw-r--r-- | archaeological_files/forms.py | 31 | ||||
-rw-r--r-- | archaeological_files/views.py | 12 |
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): """ |