summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-04-07 15:17:04 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:20 +0100
commitb2bb294b82a968b899a852f4fa64495e9cc2984f (patch)
tree532a7872f50d21c112aeb65aa9df559e2916f406 /archaeological_finds/forms.py
parent55194aeec747fc07dcaf054877dd194fd1106039 (diff)
downloadIshtar-b2bb294b82a968b899a852f4fa64495e9cc2984f.tar.bz2
Ishtar-b2bb294b82a968b899a852f4fa64495e9cc2984f.zip
Find - collections: add field to form and sheet
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r--archaeological_finds/forms.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 97ae90bf4..e018c099b 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -137,7 +137,7 @@ class BasicFindForm(CustomForm, ManageOldType):
"""
file_upload = True
form_label = _("Find")
- form_admin_name = _(u"Simple find - 020 - General")
+ form_admin_name = _("Simple find - 020 - General")
form_slug = "simplefind-020-general"
base_models = ['object_type', 'material_type', 'communicabilitie',
'cultural_attribution']
@@ -149,6 +149,7 @@ class BasicFindForm(CustomForm, ManageOldType):
'material_type_quality': models.MaterialTypeQualityType,
'object_type_quality': models.ObjectTypeQualityType,
'checked_type': models.CheckedType,
+ 'collection': Warehouse,
}
field_order = [
'label', 'denomination', 'previous_id', 'museum_id', 'laboratory_id',
@@ -174,6 +175,12 @@ class BasicFindForm(CustomForm, ManageOldType):
laboratory_id = forms.CharField(label=_(u"Laboratory ID"), required=False)
seal_number = forms.CharField(label=_(u"Seal number"), required=False)
mark = forms.CharField(label=_(u"Mark"), required=False)
+ collection = forms.IntegerField(
+ label=_("Collection (warehouse)"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-warehouse'),
+ associated_model=Warehouse, new=True),
+ validators=[valid_id(Warehouse)], required=False)
HEADERS['description'] = FormHeader(_(u"Description"))
description = forms.CharField(label=_(u"Description"),
@@ -288,7 +295,8 @@ class BasicFindForm(CustomForm, ManageOldType):
class FindForm(BasicFindForm):
file_upload = True
form_label = _("Find")
- form_admin_name = _(u"Find - 020 - General")
+ form_admin_name = _("Find - 020 - General")
+ extra_form_modals = ["warehouse"]
form_slug = "find-020-general"
base_models = ['get_first_base_find'] + BasicFindForm.base_models
associated_models = BasicFindForm.associated_models.copy()
@@ -299,8 +307,8 @@ class FindForm(BasicFindForm):
field_order = [
'label', 'denomination', 'previous_id',
'get_first_base_find__excavation_id', 'museum_id', 'laboratory_id',
- 'seal_number', 'mark', 'description', 'public_description',
- 'get_first_base_find__discovery_date',
+ 'seal_number', 'mark', 'collection', 'description',
+ 'public_description', 'get_first_base_find__discovery_date',
'get_first_base_find__discovery_date_taq', 'get_first_base_find__batch',
'is_complete', 'material_type', 'material_type_quality',
'material_comment', 'object_type',
@@ -363,6 +371,9 @@ class FindForm(BasicFindForm):
'get_first_base_find__estimated_error_z',
'get_first_base_find__spatial_reference_system'
],
+ 'warehouse': [
+ 'collection'
+ ]
}
def clean(self):
@@ -1238,6 +1249,12 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
class FindSelectWarehouseModule(FindSelect):
+ collection = forms.IntegerField(
+ label=_("Collection (warehouse)"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-warehouse'),
+ associated_model=Warehouse),
+ validators=[valid_id(Warehouse)])
container_ref__location = forms.IntegerField(
label=_(u"Reference container - Warehouse (location)"),
widget=widgets.JQueryAutoComplete(