diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-03-06 11:41:54 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-03-06 11:44:44 +0100 |
commit | 73680a9956ce9b5a81b12296a19c4c782cbb1573 (patch) | |
tree | 87dc15b6b07b78eb8aed52a707c9adab5ae89a9f /archaeological_context_records/models.py | |
parent | fa494aa77940791e2a69589ed29ecc6fc680d680 (diff) | |
download | Ishtar-73680a9956ce9b5a81b12296a19c4c782cbb1573.tar.bz2 Ishtar-73680a9956ce9b5a81b12296a19c4c782cbb1573.zip |
Sheet actions: add duplicate for site, operation, document and context record
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index febc7cfdd..9b1483e0d 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -459,7 +459,11 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, rights=['change_contextrecord', 'change_own_contextrecord'] ) QUICK_ACTIONS = [ - QA_LOCK + QA_LOCK, + QuickAction( + url="contextrecord-qa-duplicate", icon_class="fa fa-clone", + text=_(u"Duplicate"), target="one", + rights=['change_contextrecord', 'change_own_contextrecord']), ] history = HistoricalRecords(bases=[HistoryModel]) @@ -723,6 +727,19 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem, def show_url(self): return reverse('show-contextrecord', args=[self.pk, '']) + def get_extra_actions(self, request): + # url, base_text, icon, extra_text, extra css class, is a quick action + actions = super(ContextRecord, self).get_extra_actions(request) + + #is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) + can_edit_cr = self.can_do(request, 'change_contextrecord') + if can_edit_cr: + actions += [ + (reverse("contextrecord-qa-duplicate", args=[self.pk]), + _("Duplicate"), "fa fa-clone", "", "", True), + ] + return actions + @classmethod def get_query_owns(cls, ishtaruser): q = cls._construct_query_own( |