summaryrefslogtreecommitdiff
path: root/archaeological_finds/views.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
commit7343c9f1bbc28be270b2093dcd9e713a7bdcdb89 (patch)
tree0ed9392291c50980c7dbff14c9a05edc601076de /archaeological_finds/views.py
parent10b603af68689ea3b251006b7ec05855b9616811 (diff)
downloadIshtar-7343c9f1bbc28be270b2093dcd9e713a7bdcdb89.tar.bz2
Ishtar-7343c9f1bbc28be270b2093dcd9e713a7bdcdb89.zip
Adapt forms, wizards, views, urls for new management of documents (refs #4107)
Diffstat (limited to 'archaeological_finds/views.py')
-rw-r--r--archaeological_finds/views.py162
1 files changed, 5 insertions, 157 deletions
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 04264080e..2dc599807 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -19,7 +19,6 @@
import json
-from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpResponseRedirect, HttpResponse
@@ -28,25 +27,17 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.views.generic.edit import CreateView, FormView
-from ishtar_common.models import IshtarUser, get_current_profile
-from archaeological_operations.models import AdministrativeAct
-
-from ishtar_common.forms import FinalForm
-from ishtar_common.forms_common import SourceForm, AuthorFormset, \
- SourceDeletionForm
-from archaeological_operations.forms import FinalAdministrativeActDeleteForm
from archaeological_context_records.forms \
import RecordFormSelection as RecordFormSelectionTable
-
+from archaeological_operations.forms import FinalAdministrativeActDeleteForm
+from archaeological_operations.wizards import AdministrativeActDeletionWizard
+from forms import *
+from ishtar_common.forms import FinalForm
+from ishtar_common.models import IshtarUser, get_current_profile
from ishtar_common.views import get_item, show_item, display_item, \
revert_item, get_autocomplete_generic, IshtarMixin, LoginRequiredMixin
-
from ishtar_common.wizards import SearchWizard
-from archaeological_operations.wizards import AdministrativeActDeletionWizard
-
from wizards import *
-from forms import *
-import models
get_find = get_item(models.Find, 'get_find', 'find')
@@ -107,9 +98,6 @@ def autocomplete_treatmentfile(request):
return HttpResponse(data, content_type='text/plain')
-show_findsource = show_item(models.FindSource, 'findsource')
-
-get_findsource = get_item(models.FindSource, 'get_findsource', 'findsource')
show_find = show_item(models.Find, 'find')
display_find = display_item(models.Find)
revert_find = revert_item(models.Find)
@@ -134,7 +122,6 @@ def check_not_warehouse_module(self):
find_creation_steps = [
('selecrecord-find_creation', RecordFormSelectionTable),
('find-find_creation', FindForm),
- ('images-find_creation', ImagesFormset),
('preservation-find_creation', PreservationForm),
('dating-find_creation', DatingFormSet),
('final-find_creation', FinalForm)
@@ -174,7 +161,6 @@ find_modification_steps = [
('selecw-find_modification', FindFormSelectionWarehouseModule),
('selecrecord-find_modification', RecordFormSelection),
('find-find_modification', FindForm),
- ('images-find_modification', ImagesFormset),
('preservation-find_modification', PreservationForm),
('dating-find_modification', DatingFormSet),
('final-find_modification', FinalForm)
@@ -215,42 +201,6 @@ find_deletion_wizard = FindDeletionWizard.as_view(
label=_(u"Find deletion"),
url_name='find_deletion',)
-find_source_search_wizard = SearchWizard.as_view([
- ('selec-find_source_search', FindSourceFormSelection)],
- label=_(u"Find: source search"),
- url_name='find_source_search',)
-
-find_source_creation_wizard = FindSourceWizard.as_view([
- ('selec-find_source_creation', SourceFindFormSelection),
- ('source-find_source_creation', FindSourceForm),
- ('authors-find_source_creation', AuthorFormset),
- ('final-find_source_creation', FinalForm)],
- label=_(u"Find: new source"),
- url_name='find_source_creation',)
-
-find_source_modification_wizard = FindSourceWizard.as_view([
- ('selec-find_source_modification', FindSourceFormSelection),
- ('source-find_source_modification', FindSourceForm),
- ('authors-find_source_modification', AuthorFormset),
- ('final-find_source_modification', FinalForm)],
- label=_(u"Find: source modification"),
- url_name='find_source_modification',)
-
-
-def find_source_modify(request, pk):
- find_source_modification_wizard(request)
- FindSourceWizard.session_set_value(
- request, 'selec-find_source_modification', 'pk', pk, reset=True)
- return redirect(reverse(
- 'find_source_modification',
- kwargs={'step': 'source-find_source_modification'}))
-
-find_source_deletion_wizard = FindSourceDeletionWizard.as_view([
- ('selec-find_source_deletion', FindSourceFormSelection),
- ('final-find_source_deletion', SourceDeletionForm)],
- label=_(u"Find: source deletion"),
- url_name='find_source_deletion',)
-
autocomplete_objecttype = get_autocomplete_generic(models.ObjectType)
autocomplete_materialtype = get_autocomplete_generic(models.MaterialType)
autocomplete_treatmenttype = get_autocomplete_generic(models.TreatmentType)
@@ -414,7 +364,6 @@ treatment_wizard_steps = [
('basetreatment-treatment_creation', BaseTreatmentForm),
('selecfind-treatment_creation', UpstreamFindFormSelection),
('selecbasket-treatment_creation', SelectFindBasketForm),
- ('images-treatment_creation', TreatmentImagesFormset),
# ('resultfind-treatment_creation', ResultFindForm),
# ('resultfinds-treatment_creation', ResultFindFormSet),
('final-treatment_creation', FinalForm)
@@ -451,7 +400,6 @@ treatment_modification_wizard = TreatmentModificationWizard.as_view(
[('selec-treatment_modification', TreatmentFormSelection),
('file-treatment_modification', TreatmentFormFileChoice),
('basetreatment-treatment_modification', TreatmentModifyForm),
- ('images-treatment_creation', TreatmentImagesFormset),
('final-treatment_modification', FinalForm)],
label=_(u"Treatment modification"),
url_name='treatment_modification',
@@ -615,106 +563,12 @@ def treatmentfile_administrativeacttreatmentfile_modify(request, pk):
'admact-treatmentfle_admacttreatmentfle_modification'
}))
-# sources
-
-show_treatmentsource = show_item(models.TreatmentSource, 'treatmentsource')
-get_treatmentsource = get_item(models.TreatmentSource, 'get_treatmentsource',
- 'treatmentsource')
-
-treatment_source_search_wizard = SearchWizard.as_view([
- ('selec-treatment_source_search', TreatmentSourceFormSelection)],
- label=_(u"Treatment: source search"),
- url_name='treatment_source_search',)
-
-treatment_source_creation_wizard = TreatmentSourceWizard.as_view([
- ('selec-treatment_source_creation', SourceTreatmentFormSelection),
- ('source-treatment_source_creation', SourceForm),
- ('authors-treatment_source_creation', AuthorFormset),
- ('final-treatment_source_creation', FinalForm)],
- label=_(u"Treatment: new source"),
- url_name='treatment_source_creation',)
-
-treatment_source_modification_wizard = TreatmentSourceWizard.as_view([
- ('selec-treatment_source_modification', TreatmentSourceFormSelection),
- ('source-treatment_source_modification', SourceForm),
- ('authors-treatment_source_modification', AuthorFormset),
- ('final-treatment_source_modification', FinalForm)],
- label=_(u"Treatment: source modification"),
- url_name='treatment_source_modification',)
-
-
-def treatment_source_modify(request, pk):
- treatment_source_modification_wizard(request)
- TreatmentSourceWizard.session_set_value(
- request, 'selec-treatment_source_modification', 'pk', pk, reset=True)
- return redirect(reverse(
- 'treatment_source_modification',
- kwargs={'step': 'source-treatment_source_modification'}))
-
-treatment_source_deletion_wizard = TreatmentSourceDeletionWizard.as_view([
- ('selec-treatment_source_deletion', TreatmentSourceFormSelection),
- ('final-treatment_source_deletion', SourceDeletionForm)],
- label=_(u"Treatment: source deletion"),
- url_name='treatment_source_deletion',)
-
-# treatment request sources
-
-show_treatmentfilesource = show_item(models.TreatmentFileSource,
- 'treatmentfilesource')
-get_treatmentfilesource = get_item(
- models.TreatmentFileSource, 'get_treatmentfilesource',
- 'treatmentfilesource')
-
-treatmentfile_source_search_wizard = SearchWizard.as_view([
- ('selec-treatmentfile_source_search', TreatmentFileSourceFormSelection)],
- label=_(u"Treatment request: source search"),
- url_name='treatmentfile_source_search',)
-
-treatmentfile_source_creation_wizard = TreatmentFileSourceWizard.as_view([
- ('selec-treatmentfile_source_creation', SourceTreatmentFileFormSelection),
- ('source-treatmentfile_source_creation', SourceForm),
- ('authors-treatmentfile_source_creation', AuthorFormset),
- ('final-treatmentfile_source_creation', FinalForm)],
- label=_(u"Treatment request: new source"),
- url_name='treatmentfile_source_creation',)
-
-treatmentfile_source_modification_wizard = TreatmentFileSourceWizard.as_view([
- ('selec-treatmentfile_source_modification',
- TreatmentFileSourceFormSelection),
- ('source-treatmentfile_source_modification', SourceForm),
- ('authors-treatmentfile_source_modification', AuthorFormset),
- ('final-treatmentfile_source_modification', FinalForm)],
- label=_(u"Treatment request: source modification"),
- url_name='treatmentfile_source_modification',)
-
-
-def treatmentfile_source_modify(request, pk):
- treatmentfile_source_modification_wizard(request)
- TreatmentFileSourceWizard.session_set_value(
- request, 'selec-treatmentfile_source_modification', 'pk', pk,
- reset=True)
- return redirect(reverse(
- 'treatmentfile_source_modification',
- kwargs={'step': 'source-treatmentfile_source_modification'}))
-
-
-treatmentfile_source_deletion_wizard = \
- TreatmentFileSourceDeletionWizard.as_view([
- ('selec-treatmentfile_source_deletion',
- TreatmentFileSourceFormSelection),
- ('final-treatmentfile_source_deletion', SourceDeletionForm)],
- label=_(u"Treatment request: source deletion"),
- url_name='treatmentfile_source_deletion',)
-
def reset_wizards(request):
for wizard_class, url_name in (
(FindWizard, 'find_creation'),
(FindModificationWizard, 'find_modification'),
(FindDeletionWizard, 'find_deletion'),
- (FindSourceWizard, 'find_source_creation'),
- (FindSourceWizard, 'find_source_modification'),
- (FindSourceDeletionWizard, 'find_source_deletion'),
(TreatmentWizard, 'treatement_creation'),
(TreatmentModificationWizard, 'treatment_modification'),
(TreatmentDeletionWizard, 'treatment_deletion'),
@@ -731,11 +585,5 @@ def reset_wizards(request):
'treatmentfle_admacttreatmentfle_modification'),
(AdministrativeActDeletionWizard,
'treatmentfle_admacttreatmentfle_deletion'),
- (TreatmentSourceWizard, 'treatment_source_creation'),
- (TreatmentSourceWizard, 'treatment_source_modification'),
- (TreatmentSourceDeletionWizard, 'treatment_source_deletion'),
- (TreatmentFileSourceWizard, 'treatmentfile_source_creation'),
- (TreatmentFileSourceWizard, 'treatmentfile_source_modification'),
- (TreatmentFileSourceDeletionWizard, 'treatmentfile_source_deletion')
):
wizard_class.session_reset(request, url_name)