summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-01-04 12:26:35 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-01-04 12:26:35 +0100
commite45888d4d796c5f1fb121dc7e41116fa8f38bfdc (patch)
tree8d9db8d464311b45cdcf2079cd9a15d31c05b2fe
parentf458f61e9cc55a188ac87cfab5a1bb90a31b702f (diff)
downloadIshtar-e45888d4d796c5f1fb121dc7e41116fa8f38bfdc.tar.bz2
Ishtar-e45888d4d796c5f1fb121dc7e41116fa8f38bfdc.zip
Custom form: container forms
-rw-r--r--archaeological_warehouse/forms.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index f98adc33a..2e672efd4 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -160,8 +160,10 @@ class WarehouseDeletionForm(FinalForm):
confirm_end_msg = _(u"Would you like to delete this warehouse?")
-class ContainerForm(ManageOldType, forms.Form):
+class ContainerForm(CustomForm, ManageOldType, forms.Form):
form_label = _(u"Container")
+ form_admin_name = _(u"Container - 010 - General")
+ form_slug = "container-010-general"
file_upload = True
associated_models = {'container_type': models.ContainerType,
'location': models.Warehouse,
@@ -189,16 +191,14 @@ class ContainerForm(ManageOldType, forms.Form):
max_length=255, required=False, widget=widgets.ImageFileInput())
comment = forms.CharField(label=_(u"Comment"),
widget=forms.Textarea, required=False)
+ TYPES = [
+ FieldType('container_type', models.ContainerType),
+ ]
def __init__(self, *args, **kwargs):
if 'limits' in kwargs:
kwargs.pop('limits')
super(ContainerForm, self).__init__(*args, **kwargs)
- self.fields['container_type'].choices = \
- models.ContainerType.get_types(
- initial=self.init_data.get('container_type'))
- self.fields['container_type'].help_text = \
- models.ContainerType.get_help()
def save(self, user):
dct = self.cleaned_data
@@ -286,7 +286,9 @@ class FindPackagingFormSelection(FindMultipleFormSelection):
form_label = _(u"Packaged finds")
-class LocalisationForm(forms.Form):
+class LocalisationForm(CustomForm, forms.Form):
+ form_admin_name = _(u"Container - 020 - Localisation")
+ form_slug = "container-020-localisation"
form_label = _(u"Localisation")
def __init__(self, *args, **kwargs):