summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-10 20:49:13 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-10 20:49:13 +0200
commit8f18e7aa3ef8750faaf8c4cd136827555fdf66e4 (patch)
tree45f1d910b67a30e44015735581ec9cdc6db51cdf /archaeological_operations/models.py
parent3d630a998043a9a6a9d61d42f3394b121f045431 (diff)
downloadIshtar-8f18e7aa3ef8750faaf8c4cd136827555fdf66e4.tar.bz2
Ishtar-8f18e7aa3ef8750faaf8c4cd136827555fdf66e4.zip
QA: lock/unlock (sites, operations, context records, finds, containers, warehouses)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index c2e4e618b..6a25490d7 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -111,7 +111,7 @@ post_delete.connect(post_save_cache, sender=RecordQualityType)
class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem,
- GeoItem, OwnPerms, ValueGetter, ShortMenuItem):
+ GeoItem, OwnPerms, ValueGetter, MainItem):
SLUG = 'site'
APP = "archaeological-operations"
MODEL = "archaeological-site"
@@ -256,6 +256,15 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem,
'cached_remains']
DOWN_MODEL_UPDATE = ["context_records"]
+ QA_LOCK = QuickAction(
+ url="contextrecord-qa-lock", icon_class="fa fa-lock",
+ text=_(u"Lock/Unlock"), target="many",
+ rights=['change_contextrecord', 'change_own_contextrecord']
+ )
+ QUICK_ACTIONS = [
+ QA_LOCK
+ ]
+
objects = SiteManager()
reference = models.CharField(_("Reference"), max_length=200, unique=True)
@@ -870,9 +879,14 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem,
QA_EDIT = QuickAction(
url="operation-qa-bulk-update", icon_class="fa fa-pencil",
text=_(u"Bulk update"), target="many",
- rights=['change_operation', 'change_own_operation'])
+ )
+ QA_LOCK = QuickAction(
+ url="operation-qa-lock", icon_class="fa fa-lock",
+ text=_(u"Lock/Unlock"), target="many",
+ rights=['change_operation', 'change_own_operation']
+ )
QUICK_ACTIONS = [
- QA_EDIT
+ QA_EDIT, QA_LOCK
]
UP_MODEL_QUERY = {
@@ -1284,7 +1298,7 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem,
actions = super(Operation, self).get_extra_actions(request)
can_add_cr = self.can_do(request, 'add_contextrecord')
- if can_add_cr:
+ if can_add_cr and not self.locked:
actions += [
(reverse('operation-qa-contextrecord', args=[self.pk]),
_("Add context record"), "fa fa-plus",