diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-21 10:46:58 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-11-21 10:46:58 +0100 |
commit | c410be9b3c3ba193ee8c233cc6a50d065d4090fd (patch) | |
tree | 7fe4800634a6079854d7ab10c782c79fce24ea10 /archaeological_operations/wizards.py | |
parent | 9309d89a48cee876ef17213924b2cc0b026677f9 (diff) | |
download | Ishtar-c410be9b3c3ba193ee8c233cc6a50d065d4090fd.tar.bz2 Ishtar-c410be9b3c3ba193ee8c233cc6a50d065d4090fd.zip |
Custom forms: disable completly a form
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r-- | archaeological_operations/wizards.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index fffe34ca7..24c1af45b 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -23,6 +23,7 @@ from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.db.models import Max +from django.http import Http404 from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ @@ -149,7 +150,10 @@ class OperationWizard(Wizard): data = {} if not step: step = self.steps.current - form = self.get_form_list()[step] + try: + form = self.get_form_list()[step] + except KeyError: + raise Http404() # manage the dynamic choice of towns if step.startswith('towns') and hasattr(form, 'management_form'): data['TOWNS'] = self.get_towns() |