summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py99
-rw-r--r--archaeological_operations/views.py78
2 files changed, 110 insertions, 67 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 981e4e3b9..d2ec086ae 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -412,17 +412,29 @@ OPERATOR, created = OrganizationType.objects.get_or_create(txt_idx='operator')
class OperationSelect(TableSelect):
if settings.COUNTRY == 'fr':
- code_patriarche = forms.IntegerField(label="Code PATRIARCHE")
- common_name = forms.CharField(label=_(u"Name (full text search)"),
- max_length=30)
- operation_type = forms.ChoiceField(label=_(u"Operation type"),
- choices=[])
+ code_patriarche = forms.IntegerField(
+ label="Numéro d'opération (OA Patriarche)")
year = forms.IntegerField(label=_("Year"))
operation_code = forms.IntegerField(label=_(u"Numeric reference"))
towns = get_town_field()
+ parcel = ParcelField(label=_("Parcel (section/number)"))
if settings.ISHTAR_DPTS:
towns__numero_insee__startswith = forms.ChoiceField(
label="Department", choices=[])
+ common_name = forms.CharField(label=_(u"Name"),
+ max_length=30)
+ operation_type = forms.ChoiceField(label=_(u"Operation type"),
+ choices=[])
+ end_date = forms.NullBooleanField(label=_(u"Is open?"))
+ in_charge = forms.IntegerField(
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy(
+ 'autocomplete-person-permissive',
+ args=["_".join(
+ [unicode(PersonType.objects.get(txt_idx='sra_agent').pk)])]
+ ),
+ associated_model=Person),
+ label=_(u"In charge"))
scientist = forms.IntegerField(
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person-permissive',
@@ -436,23 +448,10 @@ class OperationSelect(TableSelect):
reverse_lazy('autocomplete-organization', args=[OPERATOR.pk]),
associated_model=Organization),
validators=[valid_id(Organization)])
- operator_reference = forms.CharField(label=_(u"Operator reference"),
- max_length=20)
- in_charge = forms.IntegerField(
- widget=widgets.JQueryAutoComplete(
- reverse_lazy(
- 'autocomplete-person-permissive',
- args=["_".join(
- [unicode(PersonType.objects.get(txt_idx='sra_agent').pk)])]
- ),
- associated_model=Person),
- label=_(u"In charge"))
- archaeological_sites = forms.IntegerField(
- label=_("Archaelogical site"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-archaeologicalsite'),
- associated_model=models.ArchaeologicalSite),
- validators=[valid_id(models.ArchaeologicalSite)])
+ # operator_reference = forms.CharField(label=_(u"Operator reference"),
+ # max_length=20)
+ remains = forms.ChoiceField(label=_(u"Remains"), choices=[])
+ periods = forms.ChoiceField(label=_(u"Periods"), choices=[])
start_before = forms.DateField(label=_(u"Started before"),
widget=widgets.JQueryDate)
start_after = forms.DateField(label=_(u"Started after"),
@@ -461,24 +460,34 @@ class OperationSelect(TableSelect):
widget=widgets.JQueryDate)
end_after = forms.DateField(label=_(u"Ended after"),
widget=widgets.JQueryDate)
- remains = forms.ChoiceField(label=_(u"Remains"), choices=[])
- periods = forms.ChoiceField(label=_(u"Periods"), choices=[])
- parcel = ParcelField(label=_("Parcel (section/number)"))
- end_date = forms.NullBooleanField(label=_(u"Is open?"))
+ relation_types = forms.MultipleChoiceField(
+ label=_(u"Search within relations"), choices=[],
+ widget=forms.CheckboxSelectMultiple)
+ comment = forms.CharField(label=_(u"Comment"), max_length=500)
+ abstract = forms.CharField(label=_(u"Abstract (full text search)"))
+ record_quality = forms.ChoiceField(label=_(u"Record quality"))
+ report_processing = forms.ChoiceField(label=_(u"Report processing"),
+ choices=[])
+ virtual_operation = forms.NullBooleanField(label=_(u"Virtual operation"))
+ archaeological_sites = forms.IntegerField(
+ label=_("Archaelogical site"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-archaeologicalsite'),
+ associated_model=models.ArchaeologicalSite),
+ validators=[valid_id(models.ArchaeologicalSite)])
history_creator = forms.IntegerField(
label=_(u"Created by"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person', args=['0', 'user']),
associated_model=Person),
validators=[valid_id(Person)])
- abstract = forms.CharField(label=_(u"Abstract (full text search)"))
- record_quality = forms.ChoiceField(label=_(u"Record quality"))
- report_processing = forms.ChoiceField(label=_(u"Report processing"),
- choices=[])
- virtual_operation = forms.NullBooleanField(label=_(u"Virtual operation"))
- relation_types = forms.MultipleChoiceField(
- label=_(u"Search within relations"), choices=[],
- widget=forms.CheckboxSelectMultiple)
+ history_modifier = forms.IntegerField(
+ label=_(u"Modified by"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person',
+ args=['0', 'user']),
+ associated_model=Person),
+ validators=[valid_id(Person)])
def __init__(self, *args, **kwargs):
super(OperationSelect, self).__init__(*args, **kwargs)
@@ -1075,14 +1084,18 @@ class AdministrativeActOpeSelect(TableSelect):
year = forms.IntegerField(label=_("Year"))
index = forms.IntegerField(label=_("Index"))
if settings.COUNTRY == 'fr':
- ref_sra = forms.CharField(label=u"Référence SRA",
+ ref_sra = forms.CharField(label=u"Autre référence",
max_length=15)
+ operation__code_patriarche = forms.IntegerField(
+ label="Numéro d'opération (OA Patriarche)")
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
+ indexed = forms.NullBooleanField(label=_(u"Indexed?"))
operation__towns = get_town_field()
+ parcel = ParcelField(label=_("Parcel (section/number)"))
if settings.ISHTAR_DPTS:
operation__towns__numero_insee__startswith = forms.ChoiceField(
label=_(u"Department"), choices=[])
- act_object = forms.CharField(label=_(u"Object (full text search)"),
+ act_object = forms.CharField(label=_(u"Object"),
max_length=300)
history_creator = forms.IntegerField(
label=_(u"Created by"),
@@ -1090,6 +1103,13 @@ class AdministrativeActOpeSelect(TableSelect):
reverse_lazy('autocomplete-person', args=['0', 'user']),
associated_model=Person),
validators=[valid_id(Person)])
+ history_modifier = forms.IntegerField(
+ label=_(u"Modified by"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-person',
+ args=['0', 'user']),
+ associated_model=Person),
+ validators=[valid_id(Person)])
def __init__(self, *args, **kwargs):
super(AdministrativeActOpeSelect, self).__init__(*args, **kwargs)
@@ -1102,6 +1122,13 @@ class AdministrativeActOpeSelect(TableSelect):
self.fields[k].choices = [
('', '--')] + list(settings.ISHTAR_DPTS)
+ def get_input_ids(self):
+ ids = super(AdministrativeActOpeSelect, self).get_input_ids()
+ ids.pop(ids.index('parcel'))
+ ids.append('parcel_0')
+ ids.append('parcel_1')
+ return ids
+
class AdministrativeActOpeFormSelection(forms.Form):
form_label = _("Administrative act search")
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 9482f44b4..5299b7131 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2010-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -132,26 +132,30 @@ get_operation = get_item(
bool_fields=['end_date__isnull', 'virtual_operation'],
dated_fields=['start_date__lte', 'start_date__gte',
'excavation_end_date__lte', 'excavation_end_date__gte'],
- extra_request_keys={'common_name': 'common_name__icontains',
- 'abstract': 'abstract__icontains',
- 'end_date': 'end_date__isnull',
- 'year_index': ('year', 'operation_code'),
- 'start_before': 'start_date__lte',
- 'start_after': 'start_date__gte',
- 'end_before': 'excavation_end_date__lte',
- 'end_after': 'excavation_end_date__gte',
- 'towns__numero_insee__startswith':
- 'towns__numero_insee__startswith',
- 'parcel_0': ('parcels__section',
- 'associated_file__parcels__section'),
- 'parcel_1': (
- 'parcels__parcel_number',
- 'associated_file__parcels__parcel_number'),
- 'history_creator':
- 'history_creator__ishtaruser__person__pk',
- 'archaeological_sites':
- 'archaeological_sites__pk',
- },
+ extra_request_keys={
+ 'common_name': 'common_name__icontains',
+ 'comment': 'comment__icontains',
+ 'abstract': 'abstract__icontains',
+ 'end_date': 'end_date__isnull',
+ 'year_index': ('year', 'operation_code'),
+ 'start_before': 'start_date__lte',
+ 'start_after': 'start_date__gte',
+ 'end_before': 'excavation_end_date__lte',
+ 'end_after': 'excavation_end_date__gte',
+ 'towns__numero_insee__startswith':
+ 'towns__numero_insee__startswith',
+ 'parcel_0': ('parcels__section',
+ 'associated_file__parcels__section'),
+ 'parcel_1': (
+ 'parcels__parcel_number',
+ 'associated_file__parcels__parcel_number'),
+ 'history_creator':
+ 'history_creator__ishtaruser__person__pk',
+ 'history_modifier':
+ 'history_modifier__ishtaruser__person__pk',
+ 'archaeological_sites':
+ 'archaeological_sites__pk',
+ },
)
show_operation = show_item(models.Operation, 'operation')
revert_operation = revert_item(models.Operation)
@@ -167,22 +171,34 @@ get_operationsource = get_item(
'comment': 'comment__icontains',
'additional_information': 'additional_information__icontains',
'operation__towns': 'operation__towns__pk',
+ 'operation__code_patriarche': 'operation__code_patriarche',
'operation__operation_type': 'operation__operation_type__pk',
'operation__year': 'operation__year'})
get_administrativeactop = get_item(
models.AdministrativeAct,
'get_administrativeactop', 'administrativeactop',
- extra_request_keys={'associated_file__towns': 'associated_file__towns__pk',
- 'operation__towns': 'operation__towns__pk',
- 'act_type__intented_to': 'act_type__intented_to',
- 'year': 'signature_date__year',
- 'act_object': 'act_object__icontains',
- 'history_creator':
- 'history_creator__ishtaruser__person__pk',
- 'operation__towns__numero_insee__startswith':
- 'operation__towns__numero_insee__startswith'
- },
+ extra_request_keys={
+ 'associated_file__towns': 'associated_file__towns__pk',
+ 'operation__towns': 'operation__towns__pk',
+ 'operation__code_patriarche': 'operation__code_patriarche',
+ 'act_type__intented_to': 'act_type__intented_to',
+ 'year': 'signature_date__year',
+ 'act_object': 'act_object__icontains',
+ 'history_creator':
+ 'history_creator__ishtaruser__person__pk',
+ 'history_modifier':
+ 'history_modifier__ishtaruser__person__pk',
+ 'operation__towns__numero_insee__startswith':
+ 'operation__towns__numero_insee__startswith',
+ 'indexed': 'index__isnull',
+ 'parcel_0': ('operation__parcels__section',
+ 'operation__associated_file__parcels__section'),
+ 'parcel_1': (
+ 'operation__parcels__parcel_number',
+ 'operation__associated_file__parcels__parcel_number'),
+ },
+ reversed_bool_fields=['index__isnull'],
relative_session_names={'operation': 'operation__pk'})
get_administrativeact = get_item(