summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-12-04 11:43:19 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:22 +0100
commitd992bb445b8ceea253fec86a45cc11a736cfa876 (patch)
tree6a626221e6949e5ae72aea334b4c7520496aaec0 /archaeological_files
parente19f6a8d40fa81f4985179b2d1b53b208273e754 (diff)
downloadIshtar-d992bb445b8ceea253fec86a45cc11a736cfa876.tar.bz2
Ishtar-d992bb445b8ceea253fec86a45cc11a736cfa876.zip
File: add edit button on sheet - fix research forms
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/forms.py44
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html5
2 files changed, 28 insertions, 21 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 71de4d891..6e52bcff1 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -26,12 +26,14 @@ from django import forms
from django.conf import settings
from django.core import validators
from django.forms.formsets import formset_factory
-from ishtar_common.utils import ugettext_lazy as _
+from django.utils.functional import lazy
from django.utils.safestring import mark_safe
+from ishtar_common.utils import ugettext_lazy as _
from ishtar_common.models import Person, Organization, \
valid_id, valid_ids, person_type_pks_lazy, \
- person_type_pk_lazy, organization_type_pks_lazy
+ person_type_pk_lazy, organization_type_pks_lazy, \
+ get_sra_agent_head_scientist_label
from ishtar_common.models_common import Department
from archaeological_operations.models import ActType, AdministrativeAct, \
OperationType
@@ -50,11 +52,11 @@ from bootstrap_datepicker.widgets import DatePicker
class FileSelect(DocumentItemSelect):
_model = models.File
- form_admin_name = _(u"File - 001 - Search")
+ form_admin_name = _("File - 001 - Search")
form_slug = "file-001-search"
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-files', 'file'
))
year = forms.IntegerField(label=_("Year"))
@@ -293,13 +295,13 @@ ParcelFormset.form_slug = "file-020-parcels"
class FileFormPreventive(ManageOldType, forms.Form):
- form_label = _(u"Preventive informations")
+ form_label = _("Preventive informations")
associated_models = {'general_contractor': Person,
'saisine_type': models.SaisineType,
'permit_type': models.PermitType,
'responsible_town_planning_service': Person}
general_contractor = forms.IntegerField(
- label=_(u"General contractor"),
+ label=_("General contractor"),
widget=widgets.JQueryAutoComplete(
reverse_lazy(
'autocomplete-person',
@@ -311,7 +313,7 @@ class FileFormPreventive(ManageOldType, forms.Form):
validators=[valid_id(Person)])
responsible_town_planning_service = forms.IntegerField(
required=False,
- label=_(u"Responsible for planning service"),
+ label=_("Responsible for planning service"),
widget=widgets.JQueryAutoComplete(
reverse_lazy(
'autocomplete-person',
@@ -354,6 +356,7 @@ class FileFormResearch(CustomForm, ManageOldType, forms.Form):
form_label = _("Research archaeology")
form_admin_name = _("Archaeological file - 045 - Research - General")
form_slug = "file-045-research-general"
+ extra_form_modals = ["person", "organization"]
base_model = 'department'
associated_models = {'scientist': Person,
'requested_operation_type': OperationType,
@@ -365,19 +368,28 @@ class FileFormResearch(CustomForm, ManageOldType, forms.Form):
widget=widgets.JQueryAutoComplete(
reverse_lazy(
'autocomplete-person',
- args=[person_type_pks_lazy(['head_scientist', 'sra_agent'])]),
- limit={'person_types': [person_type_pk_lazy('head_scientist'),
- person_type_pk_lazy('sra_agent')]},
- associated_model=Person, new=True),
- label=_(u"Scientist in charge"))
+ args=[person_type_pks_lazy(['head_scientist', 'sra_agent'])]
+ ),
+ limit={'person_types': [person_type_pk_lazy('head_scientist'),
+ person_type_pk_lazy('sra_agent')]},
+ tips=lazy(get_sra_agent_head_scientist_label),
+ associated_model=Person, new=True,
+ detail=True,
+ modify=True
+ ),
+ label=_("Scientist in charge"))
requested_operation_type = forms.ChoiceField(
- label=_(u"Requested operation type"), choices=[])
+ label=_("Requested operation type"), choices=[])
organization = forms.IntegerField(
- label=_(u"Lead organization"),
+ label=_("Lead organization"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-organization'),
- associated_model=Organization, new=True),
- validators=[valid_id(Organization)], required=False)
+ associated_model=Organization, new=True,
+ detail=True,
+ modify=True
+ ),
+ validators=[valid_id(Organization)], required=False,
+ )
if settings.COUNTRY == 'fr':
cira_advised = forms.NullBooleanField(label=u"Passage en CIRA",
required=False)
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
index 955dbc32a..f5a3ac6d3 100644
--- a/archaeological_files/templates/ishtar/sheet_file.html
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -4,12 +4,7 @@
{% block head_title %}<strong>{% trans "Archaeological file" %}</strong> - {{item.full_internal_ref|default:''}}{% endblock %}
{% block toolbar %}
-{% if can_add_operation %}
-{% window_file_nav item window_id previous next %}
-{% else %}
{% window_nav item window_id 'show-file' 'file_modify' 'show-historized-file' 'revert-file' previous next 1 %}
-{% endif %}
-
{% endblock %}
{% block content %}