diff options
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 |
commit | 5c0a4d451ec653d76ae26c444da8c000460c9db6 (patch) | |
tree | 532a7872f50d21c112aeb65aa9df559e2916f406 /archaeological_finds/forms.py | |
parent | ffedddae0c27f165e9d839edc5421e415b491330 (diff) | |
download | Ishtar-5c0a4d451ec653d76ae26c444da8c000460c9db6.tar.bz2 Ishtar-5c0a4d451ec653d76ae26c444da8c000460c9db6.zip |
Find - collections: add field to form and sheet
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r-- | archaeological_finds/forms.py | 25 |
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( |