summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-12-29 12:09:08 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:23 +0100
commit752d3d8eda5cd968faf0d370ae2d781575c60d90 (patch)
tree6f28b883d2ab3d8d94c0774134ce3d8d703ff277 /archaeological_operations
parentff8cf8f853914a847609c05c973e5ac199e30c6b (diff)
downloadIshtar-752d3d8eda5cd968faf0d370ae2d781575c60d90.tar.bz2
Ishtar-752d3d8eda5cd968faf0d370ae2d781575c60d90.zip
Unaccent search for person/orga. Tips for operation form
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py48
-rw-r--r--archaeological_operations/models.py10
2 files changed, 32 insertions, 26 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index c4eef1fc2..98f263ab6 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -30,6 +30,7 @@ from django.core import validators
from django.db.models import Max
from django.forms.formsets import formset_factory, DELETION_FIELD_NAME, \
TOTAL_FORM_COUNT
+from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy
@@ -46,7 +47,8 @@ from ishtar_common.forms_common import TownFormSet, get_town_field, TownForm
from ishtar_common.models import valid_id, valid_ids, Person, Town, \
DocumentTemplate, Organization, get_current_profile, \
person_type_pks_lazy, person_type_pk_lazy, organization_type_pks_lazy, \
- organization_type_pk_lazy, SpatialReferenceSystem, Area
+ organization_type_pk_lazy, SpatialReferenceSystem, Area, \
+ get_sra_agent_label, get_sra_agent_head_scientist_label, get_operator_label
from ishtar_common.wizards import MultiValueDict
from .widgets import ParcelWidget, SelectParcelWidget, OAWidget
@@ -793,7 +795,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
validators=[validators.MinValueValidator(1000),
validators.MaxValueValidator(2100)])
old_code = forms.CharField(
- label=_(u"Old code"), required=False,
+ label=_("Old code"), required=False,
validators=[validators.MaxLengthValidator(200)])
scientist = forms.IntegerField(
label=_("Head scientist"),
@@ -802,6 +804,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
'autocomplete-person',
args=[person_type_pks_lazy(['head_scientist', 'sra_agent'])]),
associated_model=Person,
+ tips=lazy(get_sra_agent_head_scientist_label),
limit={
'person_types': (person_type_pk_lazy('head_scientist'),
person_type_pk_lazy('sra_agent'))},
@@ -813,6 +816,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
reverse_lazy('autocomplete-organization',
args=[organization_type_pk_lazy('operator')]),
limit={'organization_type': organization_type_pk_lazy('operator')},
+ tips=lazy(get_operator_label),
associated_model=Organization, new=True),
validators=[valid_id(Organization)], required=False)
operator_reference = forms.CharField(label=_(u"Operator reference"),
@@ -824,6 +828,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
'autocomplete-person',
args=[person_type_pks_lazy(['sra_agent'])]),
associated_model=Person,
+ tips=lazy(get_sra_agent_label),
limit={'person_types': [person_type_pk_lazy('sra_agent')]},
new=True),
validators=[valid_id(Person)], required=False)
@@ -840,11 +845,11 @@ class OperationFormGeneral(CustomForm, ManageOldType):
report_processing = forms.ChoiceField(label=_(u"Report processing"),
choices=[], required=False)
if settings.COUNTRY == 'fr':
- cira_date = DateField(label=u"Date avis CIRA", required=False)
+ cira_date = DateField(label="Date avis CTRA/CIRA", required=False)
negative_result = forms.NullBooleanField(
- required=False, label=u"Résultat considéré comme négatif")
+ required=False, label="Résultat considéré comme négatif")
cira_rapporteur = forms.IntegerField(
- label=u"Rapporteur CIRA",
+ label="Rapporteur CTRA/CIRA",
widget=widgets.JQueryAutoComplete(
reverse_lazy(
'autocomplete-person',
@@ -853,41 +858,42 @@ class OperationFormGeneral(CustomForm, ManageOldType):
limit={'person_types': [
person_type_pk_lazy('sra_agent'),
person_type_pk_lazy('head_scientist')]},
+ tips=lazy(get_sra_agent_head_scientist_label),
associated_model=Person, new=True),
validators=[valid_id(Person)], required=False)
documentation_deadline = DateField(
- label=_(u"Deadline for submission of the documentation"),
+ label=_("Deadline for submission of the documentation"),
required=False)
documentation_received = forms.NullBooleanField(
- required=False, label=_(u"Documentation received"))
+ required=False, label=_("Documentation received"))
finds_deadline = DateField(
- label=_(u"Deadline for submission of the finds"), required=False,
+ label=_("Deadline for submission of the finds"), required=False,
)
finds_received = forms.NullBooleanField(
- required=False, label=_(u"Finds received"))
+ required=False, label=_("Finds received"))
- comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea,
+ comment = forms.CharField(label=_("Comment"), widget=forms.Textarea,
required=False)
scientific_documentation_comment = forms.CharField(
- label=_(u"Comment about scientific documentation"),
+ label=_("Comment about scientific documentation"),
widget=forms.Textarea, required=False)
- record_quality_type = forms.ChoiceField(label=_(u"Record quality"),
+ record_quality_type = forms.ChoiceField(label=_("Record quality"),
required=False)
virtual_operation = forms.BooleanField(required=False,
- label=_(u"Virtual operation"))
+ label=_("Virtual operation"))
- HEADERS['x'] = FormHeader(_(u"Coordinates"))
- x = forms.FloatField(label=_(u"X"), required=False)
- estimated_error_x = forms.FloatField(label=_(u"Estimated error for X"),
+ HEADERS['x'] = FormHeader(_("Coordinates"))
+ x = forms.FloatField(label=_("X"), required=False)
+ estimated_error_x = forms.FloatField(label=_("Estimated error for X"),
required=False)
- y = forms.FloatField(label=_(u"Y"), required=False)
- estimated_error_y = forms.FloatField(label=_(u"Estimated error for Y"),
+ y = forms.FloatField(label=_("Y"), required=False)
+ estimated_error_y = forms.FloatField(label=_("Estimated error for Y"),
required=False)
- z = forms.FloatField(label=_(u"Z"), required=False)
- estimated_error_z = forms.FloatField(label=_(u"Estimated error for Z"),
+ z = forms.FloatField(label=_("Z"), required=False)
+ estimated_error_z = forms.FloatField(label=_("Estimated error for Z"),
required=False)
spatial_reference_system = forms.ChoiceField(
- label=_(u"Spatial Reference System"), required=False, choices=[])
+ label=_("Spatial Reference System"), required=False, choices=[])
FILE_FIELDS = [
'report_delivery_date',
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 7f23399ea..8436121a4 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -786,9 +786,9 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem,
'in_charge__surname': _("In charge (surname)"),
'in_charge__name': _("In charge (name)"),
'in_charge__attached_to__name': _("In charge - Organization (name)"),
- 'cira_rapporteur__surname': "Rapporteur CIRA (prénom)",
- 'cira_rapporteur__name': "Rapporteur CIRA (nom)",
- 'cira_rapporteur__attached_to__name': "Rapporteur CIRA - "
+ 'cira_rapporteur__surname': "Rapporteur CTRA/CIRA (prénom)",
+ 'cira_rapporteur__name': "Rapporteur CTRA/CIRA (nom)",
+ 'cira_rapporteur__attached_to__name': "Rapporteur CTRA/CIRA - "
"Organisation (nom)",
'archaeological_sites__reference':
_("Archaeological sites (reference)"),
@@ -1116,10 +1116,10 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem,
null=True) # preventive diag
cira_rapporteur = models.ForeignKey(
Person, related_name='cira_rapporteur', null=True, blank=True,
- on_delete=models.SET_NULL, verbose_name="Rapporteur CIRA")
+ on_delete=models.SET_NULL, verbose_name="Rapporteur CTRA/CIRA")
negative_result = models.NullBooleanField(
"Résultat considéré comme négatif", blank=True, null=True)
- cira_date = models.DateField("Date avis CIRA", null=True, blank=True)
+ cira_date = models.DateField("Date avis CTRA/CIRA", null=True, blank=True)
eas_number = models.CharField("Numéro de l'EA", max_length=20,
null=True, blank=True)
## end fr