summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_treatments.py6
-rw-r--r--archaeological_finds/templates/ishtar/sheet_treatment.html2
-rw-r--r--archaeological_finds/templates/ishtar/sheet_treatmentfile.html2
-rw-r--r--archaeological_finds/urls.py4
-rw-r--r--archaeological_finds/views.py19
5 files changed, 31 insertions, 2 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index e0fb8683c..ec1ebf7a2 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -414,6 +414,12 @@ class TreatmentFile(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter):
def __unicode__(self):
return self.cached_label
+ @property
+ def associated_filename(self):
+ return "-".join([str(slugify(getattr(self, attr)))
+ for attr in ('year', 'index', 'internal_reference',
+ 'name') if getattr(self, attr)])
+
def _generate_cached_label(self):
items = [unicode(getattr(self, k))
for k in ['year', 'index', 'internal_reference', 'name'] if
diff --git a/archaeological_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html
index f1bfd68d2..a18cc9873 100644
--- a/archaeological_finds/templates/ishtar/sheet_treatment.html
+++ b/archaeological_finds/templates/ishtar/sheet_treatment.html
@@ -4,7 +4,7 @@
{% block head_title %}{% trans "Treatment" %}{% endblock %}
{% block content %}
-{% window_nav item window_id 'show-treatment' %}
+{% window_nav item window_id 'show-treatment' 'treatment_modify' %}
{% if item.image %}
<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a>
diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
index d569c5f0f..b142d3516 100644
--- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
+++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html
@@ -4,7 +4,7 @@
{% block head_title %}{% trans "Treatment file" %}{% endblock %}
{% block content %}
-{% window_nav item window_id 'show-treatmentfile' %}
+{% window_nav item window_id 'show-treatmentfile' 'treatmentfile_modify' %}
<p class="window-refs">{{ item.name|default:"" }}</p>
{% if item.internal_reference %}
diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py
index 843cfead9..f1ddb1223 100644
--- a/archaeological_finds/urls.py
+++ b/archaeological_finds/urls.py
@@ -96,6 +96,8 @@ urlpatterns = patterns(
check_rights(['change_find', 'change_own_find'])(
views.treatment_modification_wizard),
name='treatment_modification'),
+ url(r'treatment_modify/(?P<pk>.+)/$',
+ views.treatment_modify, name='treatment_modify'),
url(r'^treatment_search/(?P<step>.+)?$',
check_rights(['view_find', 'view_own_find'])(
views.treatment_search_wizard), name='treatment_search'),
@@ -209,6 +211,8 @@ urlpatterns = patterns(
check_rights(['change_find', 'change_own_find'])(
views.treatmentfile_modification_wizard),
name='treatmentfile_modification'),
+ url(r'^treatmentfile_modify/(?P<pk>.+)/$',
+ views.treatmentfile_modify, name='treatmentfile_modify'),
url(r'^treatmentfle_deletion/(?P<step>.+)?$',
check_rights(['change_find', 'change_own_find'])(
views.treatmentfile_deletion_wizard),
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 2b5aef79c..01e579566 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -384,6 +384,16 @@ treatment_modification_wizard = TreatmentModificationWizard.as_view(
url_name='treatment_modification',
)
+
+def treatment_modify(request, pk):
+ treatment_modification_wizard(request)
+ TreatmentModificationWizard.session_set_value(
+ request, 'selec-treatment_modification', 'pk', pk, reset=True)
+ return redirect(reverse(
+ 'treatment_modification',
+ kwargs={'step': 'basetreatment-treatment_modification'}))
+
+
treatment_deletion_wizard = TreatmentDeletionWizard.as_view([
('selec-treatment_deletion', TreatmentFormSelection),
('final-treatment_deletion', TreatmentDeletionForm)],
@@ -466,6 +476,15 @@ treatmentfile_modification_wizard = TreatmentFileModificationWizard.as_view(
url_name='treatmentfile_modification',
)
+
+def treatmentfile_modify(request, pk):
+ treatmentfile_modification_wizard(request)
+ TreatmentFileModificationWizard.session_set_value(
+ request, 'selec-treatmentfile_modification', 'pk', pk, reset=True)
+ return redirect(reverse(
+ 'treatmentfile_modification',
+ kwargs={'step': 'treatmentfile-treatmentfile_modification'}))
+
treatmentfile_deletion_wizard = TreatmentFileDeletionWizard.as_view([
('selec-treatmentfile_deletion', TreatmentFileFormSelection),
('final-treatmentfile_deletion', TreatmentFileDeletionForm)],