summaryrefslogtreecommitdiff
path: root/archaeological_operations/wizards.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r--archaeological_operations/wizards.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index 572a25ca0..94aafb87c 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -17,6 +17,8 @@
# See the file COPYING for details.
+import logging
+
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
@@ -33,6 +35,8 @@ from forms import GenerateDocForm
from archaeological_files.models import File
+logger = logging.getLogger(__name__)
+
class OperationWizard(Wizard):
model = models.Operation
@@ -73,7 +77,7 @@ class OperationWizard(Wizard):
def get_reminder(self):
archaeological_file = self.get_current_file()
if archaeological_file:
- return ((_("Archaelogical file"),
+ return ((_("Archaeological file"),
unicode(archaeological_file)),)
def get_context_data(self, form, **kwargs):
@@ -86,7 +90,7 @@ class OperationWizard(Wizard):
if step.startswith('towns'):
context['TOWNS'] = self.get_towns()
elif step.startswith('parcels-') and self.get_current_file():
- # if a file is acciated to the operation add the button "Add all"
+ # if a file is associated to the operation add the button "Add all"
context['add_all'] = True
if step.startswith('parcels') and \
hasattr(self, 'automatic_parcel_association'):
@@ -189,14 +193,14 @@ class OperationWizard(Wizard):
def get_formated_datas(self, forms):
"""
- Show a specific warning if no archaelogical file is provided
+ Show a specific warning if no archaeological file is provided
"""
datas = super(OperationWizard, self).get_formated_datas(forms)
# if the general town form is used the advertissement is relevant
has_no_af = [form.prefix for form in forms
if form.prefix == 'townsgeneral-operation'] and True
if has_no_af:
- datas = [[_(u"Warning: No Archaelogical File is provided. "
+ datas = [[_(u"Warning: No Archaeological File is provided. "
u"If you have forget it return to the first step."), []]]\
+ datas
return datas
@@ -245,7 +249,7 @@ class OperationWizard(Wizard):
request = self.request
post_data = request.POST.copy()
- # add all parcel from available in the archaelogical file
+ # add all parcel from available in the archaeological file
if not post_data.get('add_all_parcels'):
return super(OperationWizard, self).post(*args, **kwargs)
@@ -327,6 +331,7 @@ class OperationAdministrativeActWizard(OperationWizard):
edit = False
wizard_done_window = reverse_lazy('show-administrativeact')
current_obj_slug = 'administrativeactop'
+ ref_object_key = 'operation'
def get_reminder(self):
form_key = 'selec-' + self.url_name
@@ -389,11 +394,9 @@ class OperationAdministrativeActWizard(OperationWizard):
else:
associated_item = self.get_associated_item(dct)
if not associated_item:
+ logger.warning("Admin act save: no associated model")
return self.render(form_list[-1])
- if isinstance(associated_item, File):
- dct['associated_file'] = associated_item
- elif isinstance(associated_item, models.Operation):
- dct['operation'] = associated_item
+ dct[self.ref_object_key] = associated_item
admact = models.AdministrativeAct(**dct)
admact.save()
dct['item'] = admact