summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-12-11 12:09:02 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-12-11 12:09:02 +0100
commit01b9415c6ee3cab14928a4ea739e8eef89efcc33 (patch)
treec8261014dbbe0b0a0243425e1a97060f52904e70
parent34040674500428a54a201d9d3a885769f2d1b056 (diff)
downloadIshtar-01b9415c6ee3cab14928a4ea739e8eef89efcc33.tar.bz2
Ishtar-01b9415c6ee3cab14928a4ea739e8eef89efcc33.zip
History only for superuser
-rw-r--r--archaeological_operations/tests.py22
-rw-r--r--ishtar_common/templates/ishtar/blocks/window_nav.html4
2 files changed, 26 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 9466257a4..672c06647 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -1517,6 +1517,28 @@ class OperationTest(TestCase, OperationInitTest):
self.assertEqual(response.status_code, 200)
self.assertIn(b'class="card sheet"', response.content)
+ def test_show_history(self):
+ operation = self.operations[-1]
+ c = Client()
+
+ operation = models.Operation.objects.get(id=operation.id)
+ operation._force_history = True
+ operation.common_name = "hophop"
+ operation.history_modifier = self.user
+ operation.save()
+
+ c.login(username=self.username, password=self.password)
+ response = c.get(reverse('show-operation', kwargs={'pk': operation.pk}))
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(b'class="card sheet"', response.content)
+ self.assertIn(b'/show-historized-operation/', response.content)
+
+ c.login(username=self.alt_username, password=self.alt_password)
+ response = c.get(reverse('show-operation', kwargs={'pk': operation.pk}))
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(b'class="card sheet"', response.content)
+ self.assertNotIn(b'/show-historized-operation/', response.content)
+
def test_show_pdf(self):
operation = self.operations[0]
c = Client()
diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html
index 60e620f16..1d8121faf 100644
--- a/ishtar_common/templates/ishtar/blocks/window_nav.html
+++ b/ishtar_common/templates/ishtar/blocks/window_nav.html
@@ -1,5 +1,6 @@
{% load i18n ishtar_helpers %}
<div class="row toolbar">
+ {% if current_user.is_superuser %}
{% if previous or next %}
<div class='col-md-2'>
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans 'History'%}">
@@ -31,6 +32,9 @@
{% else %}
<div class='offset-md-6 col-md-6 text-right'>
{% endif %}
+ {% else %}
+ <div class='offset-md-6 col-md-6 text-right'>
+ {% endif %}
{% if pin_action and item.SLUG %}
<div class="btn-group btn-group-sm" role="group"
aria-label="{% trans 'Pin' %}">