diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-11 16:19:59 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-11 16:19:59 +0100 | 
| commit | 1e05946531d237dc954f46ddfc25a6b61c084a74 (patch) | |
| tree | 8b9137dd9b68121db86e4e22dfdb7b7016a6f1ad /archaeological_warehouse/wizards.py | |
| parent | 4779acd3006e6d6b17babd13585a4d83fb8d2332 (diff) | |
| parent | 9eced41d76545bd2921605b7b81bd14b875ce541 (diff) | |
| download | Ishtar-1e05946531d237dc954f46ddfc25a6b61c084a74.tar.bz2 Ishtar-1e05946531d237dc954f46ddfc25a6b61c084a74.zip | |
Merge branch 'develop'
Diffstat (limited to 'archaeological_warehouse/wizards.py')
| -rw-r--r-- | archaeological_warehouse/wizards.py | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py index 41c5c5945..03258f1e2 100644 --- a/archaeological_warehouse/wizards.py +++ b/archaeological_warehouse/wizards.py @@ -38,9 +38,18 @@ class ContainerSearch(SearchWizard):  class PackagingWizard(TreatmentWizard):      basket_step = 'base-packaging' +    def get_form_initial(self, step, data=None): +        initial = super(PackagingWizard, self).get_form_initial(step) +        user = self.request.user +        if step != 'base-packaging' or not getattr(user, 'ishtaruser', None) \ +                or not user.ishtaruser.person: +            return initial +        initial['person'] = user.ishtaruser.person.pk +        return initial +      def save_model(self, dct, m2m, whole_associated_models, form_list,                     return_object): -        dct = self.get_extra_model(dct, form_list) +        dct = self.get_extra_model(dct, m2m, form_list)          obj = self.get_current_saved_object()          dct['location'] = dct['container'].location          items = None @@ -51,6 +60,8 @@ class PackagingWizard(TreatmentWizard):                  items = dct.pop('basket')              else:                  dct.pop('basket') +        if 'treatment_type_list' in dct: +            dct.pop('treatment_type_list')          treatment = Treatment(**dct)          extra_args_for_new = {"container": dct['container']}          treatment.save(items=items, user=self.request.user, | 
