diff options
Diffstat (limited to 'archaeological_files_pdl/wizards.py')
| -rw-r--r-- | archaeological_files_pdl/wizards.py | 23 | 
1 files changed, 21 insertions, 2 deletions
diff --git a/archaeological_files_pdl/wizards.py b/archaeological_files_pdl/wizards.py index eb3611b26..ebf09178d 100644 --- a/archaeological_files_pdl/wizards.py +++ b/archaeological_files_pdl/wizards.py @@ -48,12 +48,26 @@ class FileWizard(BaseFileWizard):                  returned['status'] = self.request.GET['status']          if args and args[0].startswith('instruction-'):              returned['year'] = self.get_current_year() +            returned['saisine_type'] = self.get_saisine_type() +            returned['reception_date'] = \ +                self.session_get_value( +                    'general-' + self.url_name, 'reception_date')          return returned +    def get_saisine_type(self): +        try: +            idx = int( +                self.session_get_value( +                    'preventivetype-' + self.url_name, 'saisine_type')) +            return models.SaisineType.objects.get(pk=idx) +        except (ValueError, models.PermitType.DoesNotExist): +            pass +      def get_context_data(self, form, **kwargs):          context = super(FileWizard, self).get_context_data(form) -        formkey = "planningservice-" + self.url_name -        if self.steps.current == formkey: +        formplanning = "planningservice-" + self.url_name +        forminstruction = "instruction-" + self.url_name +        if self.steps.current == formplanning:              try:                  idx = int(                      self.session_get_value( @@ -63,6 +77,11 @@ class FileWizard(BaseFileWizard):                  context['permit_type_code'] = unicode(permit_type.txt_idx)              except (ValueError, models.PermitType.DoesNotExist):                  pass +        elif self.steps.current == forminstruction: +            saisine_type = self.get_saisine_type() +            if saisine_type: +                context['saisine_type'] = unicode(saisine_type) +                context['saisine_type_delay'] = saisine_type.delay or 0          return context  | 
