diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2015-10-27 03:03:51 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2015-10-27 03:03:51 +0100 | 
| commit | 06bcf48bb8c27aafeda817ccc63d1e4961a7174e (patch) | |
| tree | 4d50ee8b814c84069bab176d043ddd4a888451bb /archaeological_files_pdl/wizards.py | |
| parent | dd633b6452d4ffacb850de227d847188ab5877bb (diff) | |
| download | Ishtar-06bcf48bb8c27aafeda817ccc63d1e4961a7174e.tar.bz2 Ishtar-06bcf48bb8c27aafeda817ccc63d1e4961a7174e.zip  | |
Archaeological files forms: automatically manage instruction date
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  | 
