summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-03-07 17:20:18 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-03-07 17:20:18 +0100
commitcc05d8f59db768cd3deefb5424b71e3ee7511552 (patch)
tree9ced1fb99aa3f63bfb3440320117e88613f3c1b7
parente91a151d549bfc06cb27772e717b80412a39ff61 (diff)
downloadIshtar-cc05d8f59db768cd3deefb5424b71e3ee7511552.tar.bz2
Ishtar-cc05d8f59db768cd3deefb5424b71e3ee7511552.zip
Finds: deletion (refs #2812)
-rw-r--r--archaeological_finds/forms.py7
-rw-r--r--archaeological_finds/ishtar_menu.py5
-rw-r--r--archaeological_finds/models.py2
-rw-r--r--archaeological_finds/urls.py3
-rw-r--r--archaeological_finds/views.py6
-rw-r--r--archaeological_finds/wizards.py10
6 files changed, 30 insertions, 3 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 83a9e2da3..3cfe13ea9 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -36,7 +36,7 @@ import models
from ishtar_common import widgets
from ishtar_common.forms import FormSet, FloatField, \
- get_form_selection, reverse_lazy, TableSelect, get_now
+ get_form_selection, reverse_lazy, TableSelect, get_now, FinalForm
from ishtar_common.forms_common import get_town_field, SourceSelect
@@ -314,6 +314,11 @@ ResultFindFormSet = formset_factory(ResultFindForm, can_delete=True,
ResultFindFormSet.form_label = _(u"Resulting finds")
+class FindDeletionForm(FinalForm):
+ confirm_msg = " "
+ confirm_end_msg = _(u"Would you like to delete this find?")
+
+
class UpstreamFindFormSelection(FindFormSelection):
form_label = _(u"Upstream find")
diff --git a/archaeological_finds/ishtar_menu.py b/archaeological_finds/ishtar_menu.py
index ea8cd2c1f..daa12a37b 100644
--- a/archaeological_finds/ishtar_menu.py
+++ b/archaeological_finds/ishtar_menu.py
@@ -50,6 +50,11 @@ MENU_SECTIONS = [
# model=models.Treatment,
# access_controls=['add_treatment',
# 'add_own_treatment']),
+ MenuItem(
+ 'find_deletion', _(u"Deletion"),
+ model=models.Find,
+ access_controls=['change_find',
+ 'change_own_find']),
SectionItem(
'find_source', _(u"Documentation"),
childs=[
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 9308be593..b52aabbf2 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2012-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2012-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py
index e38520329..acf9c46a6 100644
--- a/archaeological_finds/urls.py
+++ b/archaeological_finds/urls.py
@@ -38,6 +38,9 @@ urlpatterns = patterns(
url(r'find_modification/(?P<step>.+)?$',
check_rights(['change_find', 'change_own_find'])(
views.find_modification_wizard), name='find_modification'),
+ url(r'find_deletion/(?P<step>.+)?$',
+ check_rights(['change_find', 'change_own_find'])(
+ views.find_deletion_wizard), name='find_deletion'),
url(r'find_modify/(?P<pk>.+)/$',
views.find_modify, name='find_modify'),
url(r'find_source_creation/(?P<step>.+)?$',
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index f09b3099b..3321b9925 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -120,6 +120,12 @@ def find_modify(request, pk):
reverse('find_modification',
kwargs={'step': 'find-find_modification'}))
+find_deletion_wizard = FindDeletionWizard.as_view([
+ ('selec-find_deletion', FindFormSelection),
+ ('final-find_deletion', FindDeletionForm)],
+ label=_(u"Find deletion"),
+ url_name='find_deletion',)
+
find_source_creation_wizard = FindSourceWizard.as_view([
('selec-find_source_creation', SourceFindFormSelection),
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index 1dc6ff348..61636aa25 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2012-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2012-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -75,6 +75,14 @@ class FindModificationWizard(FindWizard):
filter_owns = {'selec-find_modification': ['pk']}
+class FindDeletionWizard(DeletionWizard):
+ model = models.Find
+ fields = ['label', 'material_types', 'datings', 'find_number',
+ 'object_types', 'description', 'conservatory_state', 'mark',
+ 'preservation_to_considers', 'integrities', 'volume',
+ 'weight', 'length', 'width', 'height', 'diameter', 'comment']
+
+
class TreatmentWizard(Wizard):
model = models.Treatment