summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 18:49:38 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 18:49:38 +0200
commit41fa659fa8c53aa30dae3d6bf6bb9965eaf08d94 (patch)
treee7e19b115e0bd59f46521615584bb6b0180ace91 /ishtar_common/wizards.py
parentc8f19ffca144e3e940bd0b878bf82f70192780e8 (diff)
downloadIshtar-41fa659fa8c53aa30dae3d6bf6bb9965eaf08d94.tar.bz2
Ishtar-41fa659fa8c53aa30dae3d6bf6bb9965eaf08d94.zip
Document: deletion
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py42
1 files changed, 6 insertions, 36 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 69f7c4c8e..979f611ce 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1735,41 +1735,11 @@ class SourceWizard(Wizard):
dct.pop('history_modifier')
return dct
-"""
-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 DocumentDeletionWizard(DeletionWizard):
+ model = models.Document
+ fields = [f.name for f in model._meta.get_fields()
+ if f.name != 'id' and f.name not in model.RELATED_MODELS] + \
+ model.RELATED_MODELS
+ filter_owns = {'selec-document_deletion': ['pk']}
-class OperationSourceDeletionWizard(DeletionWizard):
- model = models.OperationSource
- fields = ['operation', 'title', 'source_type', 'authors']
-"""