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.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index 70583068b..7d349b8b7 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -67,6 +67,12 @@ class OperationWizard(Wizard):
except(TypeError, ValueError, ObjectDoesNotExist):
pass
+ def get_reminder(self):
+ archaeological_file = self.get_current_file()
+ if archaeological_file:
+ return ((_("Archaelogical file"),
+ unicode(archaeological_file)),)
+
def get_context_data(self, form, **kwargs):
"""
Return extra context for templates
@@ -80,11 +86,9 @@ class OperationWizard(Wizard):
# if a file is acciated to the operation add the button "Add all"
context['add_all'] = True
# reminder of the current file
- archaeological_file = self.get_current_file()
- if not archaeological_file:
- return context
- context['reminders'] = ((_("Archaelogical file"),
- unicode(archaeological_file)),)
+ reminder = self.get_reminder()
+ if reminder:
+ context['reminders'] = reminder
return context
def get_towns(self):
@@ -277,6 +281,27 @@ class OperationSourceDeletionWizard(DeletionWizard):
class OperationAdministrativeActWizard(OperationWizard):
edit = False
+ def get_reminder(self):
+ form_key = 'selec-' + self.url_name
+ if self.url_name.endswith('_administrativeactop'):
+ # modification and deletion are suffixed with '_modification'
+ # and '_deletion' so it is creation
+ operation_id = self.session_get_value(form_key, "pk")
+ try:
+ return ((_(u"Operation"),
+ unicode(models.Operation.objects.get(pk=operation_id))),)
+ except models.Operation.DoesNotExist:
+ return
+ else:
+ admin_id = self.session_get_value(form_key, "pk")
+ try:
+ admin = models.AdministrativeAct.objects.get(pk=admin_id)
+ if not admin.operation:
+ return
+ return ((_(u"Operation"), unicode(admin.operation)),)
+ except models.AdministrativeAct.DoesNotExist:
+ return
+
def get_extra_model(self, dct, form_list):
dct['history_modifier'] = self.request.user
return dct