diff options
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 |
commit | 3dae10a792d49d685debfe52eb7d61b9a6dc93f9 (patch) | |
tree | 45f1d910b67a30e44015735581ec9cdc6db51cdf /archaeological_operations/models.py | |
parent | 58178a04b3e716a063b1c457018aafe28e5107dd (diff) | |
download | Ishtar-3dae10a792d49d685debfe52eb7d61b9a6dc93f9.tar.bz2 Ishtar-3dae10a792d49d685debfe52eb7d61b9a6dc93f9.zip |
QA: lock/unlock (sites, operations, context records, finds, containers, warehouses)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 22 |
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", |