summaryrefslogtreecommitdiff
path: root/archaeological_operations/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-01 15:50:52 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 09:57:24 +0200
commit572b9047260322ed19cc9f674657b8be8d62c052 (patch)
tree0ed9392291c50980c7dbff14c9a05edc601076de /archaeological_operations/wizards.py
parent66a376e081e335cf94ecf6fd41e5fe13a5445c57 (diff)
downloadIshtar-572b9047260322ed19cc9f674657b8be8d62c052.tar.bz2
Ishtar-572b9047260322ed19cc9f674657b8be8d62c052.zip
Adapt forms, wizards, views, urls for new management of documents (refs #4107)
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r--archaeological_operations/wizards.py48
1 files changed, 3 insertions, 45 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index d4830a2e7..a8f8ef80b 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -22,21 +22,17 @@ import logging
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 _
-from ishtar_common.models import get_current_profile
from archaeological_files.models import File
from archaeological_operations import models
-
-from ishtar_common.forms import reverse_lazy
from forms import GenerateDocForm
-
+from ishtar_common.forms import reverse_lazy
+from ishtar_common.models import get_current_profile
from ishtar_common.wizards import Wizard, ClosingWizard, DeletionWizard, \
- SourceWizard, SearchWizard
-
+ SearchWizard
logger = logging.getLogger(__name__)
@@ -303,44 +299,6 @@ class OperationDeletionWizard(DeletionWizard):
filter_owns = {'selec-operation_deletion': ['pk']}
-class OperationSourceWizard(SourceWizard):
- model = models.OperationSource
- wizard_done_window = reverse_lazy('show-operationsource')
-
- def get_form_initial(self, step, data=None):
- initial = super(OperationSourceWizard, self).get_form_initial(step)
- # put default index and operation_id field in the main source form
- general_form_key = 'selec-' + self.url_name
- if step.startswith('source-'):
- operation_id = None
- if self.session_has_key(general_form_key, 'operation'):
- try:
- operation_id = int(self.session_get_value(general_form_key,
- "operation"))
- except ValueError:
- pass
- elif self.session_has_key(general_form_key, "pk"):
- try:
- pk = self.session_get_value(general_form_key, "pk")
- source = models.OperationSource.objects.get(pk=pk)
- operation_id = source.operation.pk
- except (ValueError, ObjectDoesNotExist):
- pass
- if operation_id:
- initial['hidden_operation_id'] = operation_id
- if 'index' not in initial:
- max_val = models.OperationSource.objects.filter(
- operation__pk=operation_id).aggregate(
- Max('index'))["index__max"]
- initial['index'] = max_val and (max_val + 1) or 1
- return initial
-
-
-class OperationSourceDeletionWizard(DeletionWizard):
- model = models.OperationSource
- fields = ['operation', 'title', 'source_type', 'authors']
-
-
class OperationAdministrativeActWizard(OperationWizard):
edit = False
wizard_done_window = reverse_lazy('show-administrativeact')