summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-12-18 18:34:43 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-12-18 18:34:43 +0100
commit2d7e9cd3d49e918f37a30352f35d1ad4c2ace769 (patch)
tree617d32c1aaa8c85a4782aecfa64d075f598af0dc /archaeological_warehouse/wizards.py
parentbd6026dfd15dc58958aff61ffac9ab08da0d49ee (diff)
downloadIshtar-2d7e9cd3d49e918f37a30352f35d1ad4c2ace769.tar.bz2
Ishtar-2d7e9cd3d49e918f37a30352f35d1ad4c2ace769.zip
Containers / Warehouse: actions, sheets and fixes.
Diffstat (limited to 'archaeological_warehouse/wizards.py')
-rw-r--r--archaeological_warehouse/wizards.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py
index 407a58ad6..cfe5be4d4 100644
--- a/archaeological_warehouse/wizards.py
+++ b/archaeological_warehouse/wizards.py
@@ -17,13 +17,12 @@
# See the file COPYING for details.
-from django.contrib.formtools.wizard.views import NamedUrlWizardView
from django.shortcuts import render_to_response
from django.template import RequestContext
from ishtar_common.wizards import Wizard
from archaeological_finds.wizards import TreatmentWizard
-from archaeological_finds.models import Treatment
+from archaeological_finds.models import Treatment, TreatmentType
import models
@@ -36,11 +35,20 @@ class PackagingWizard(TreatmentWizard):
dct = self.get_extra_model(dct, form_list)
obj = self.get_current_saved_object()
dct['location'] = dct['container'].location
- items = dct.pop('basket')
+ items = None
+ if 'items' in dct:
+ items = dct.pop('items')
+ if 'basket' in dct:
+ if not items:
+ items = dct.pop('basket')
+ else:
+ dct.pop('basket')
treatment = Treatment(**dct)
extra_args_for_new = {"container": dct['container']}
treatment.save(items=items, user=self.request.user,
extra_args_for_new=extra_args_for_new)
+ packaging = TreatmentType.objects.get(txt_idx='packaging')
+ treatment.treatment_types.add(packaging)
res = render_to_response('ishtar/wizard/wizard_done.html', {},
context_instance=RequestContext(self.request))
return return_object and (obj, res) or res