diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-20 12:03:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-20 12:03:22 +0100 |
commit | d41e913396ad470f7e898bdfbca3d2cb4d2144c2 (patch) | |
tree | 08f867c0fa37ec5640c0ce275b38b3f5e5ff7514 /archaeological_warehouse | |
parent | c37bb6ecce45fccc1f0c9d321a785ffeeefc3366 (diff) | |
download | Ishtar-d41e913396ad470f7e898bdfbca3d2cb4d2144c2.tar.bz2 Ishtar-d41e913396ad470f7e898bdfbca3d2cb4d2144c2.zip |
Warehouse: fix warehouse creation with no divisions (refs #3481)
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/forms.py | 3 | ||||
-rw-r--r-- | archaeological_warehouse/tests.py | 21 |
2 files changed, 22 insertions, 2 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index d76ce6b70..553a01ce5 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -281,7 +281,8 @@ class LocalisationForm(forms.Form): if q.count(): initial = q.all()[0].reference self.fields['division_{}'.format(divlink.pk)] = forms.CharField( - label=str(divlink.division), max_length=200, initial=initial) + label=str(divlink.division), max_length=200, initial=initial, + ) class ContainerDeletionForm(FinalForm): diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 691275876..7eb3017bc 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -64,12 +64,31 @@ class WarehouseWizardCreationTest(WizardTest, FindInit, TestCase): ] }, ), + FormData( + 'Warehouse creation with no division', + form_datas={ + 'warehouse-warehouse_creation': { + 'name': 'warehouse-ref', + 'warehouse_type': None, + 'location': None, + 'responsible': None, + }, + 'divisions-warehouse_creation': [ + { + 'order': 42 + } + ] + }, + ), ] def pre_wizard(self): main_data = self.form_datas[0].form_datas + alt_data = self.form_datas[1].form_datas main_data['warehouse-warehouse_creation']['warehouse_type'] = \ models.WarehouseType.objects.all()[0].pk + alt_data['warehouse-warehouse_creation']['warehouse_type'] = \ + models.WarehouseType.objects.all()[0].pk main_data['divisions-warehouse_creation'][0]['division'] = \ models.WarehouseDivision.create_default_for_test()[0].pk self.warehouse_number = models.Warehouse.objects.count() @@ -78,7 +97,7 @@ class WarehouseWizardCreationTest(WizardTest, FindInit, TestCase): def post_wizard(self): self.assertEqual(models.Warehouse.objects.count(), - self.warehouse_number + 1) + self.warehouse_number + 2) self.assertEqual(models.WarehouseDivisionLink.objects.count(), self.warehouse_div_link + 1) |