summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index f8c8f20a0..63904bebe 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -759,18 +759,31 @@ class ArchaeologicalSite(
base_finds__context_record__archaeological_site__pk=self.pk
)
- def get_extra_actions(self, request):
+ def get_extra_actions(self, request, window_id=None):
"""
For sheet template
"""
# url, base_text, icon, extra_text, extra css class, is a quick action
actions = super(ArchaeologicalSite, self).get_extra_actions(request)
- # is_locked = self.is_locked(request.user)
+ is_locked = self.is_locked(request.user)
profile = get_current_profile()
+ can_edit_site = self.can_do(request, "change_archaeologicalsite")
can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata")
if can_add_geo:
actions.append(self.get_add_geo_action())
+ if can_edit_site and not is_locked:
+ actions += [
+ (
+ reverse("site-operation-relations-modify", args=[self.pk, window_id]),
+ _("Modify site-operation relations"),
+ "fa fa-retweet",
+ _("operations"),
+ "",
+ True,
+ ),
+ ]
+
can_create_operation = self.can_do(request, "change_operation")
if can_create_operation and not self.operations.count():
actions.append(
@@ -796,7 +809,6 @@ class ArchaeologicalSite(
)
)
- can_edit_site = self.can_do(request, "change_archaeologicalsite")
if can_edit_site:
actions += [
(
@@ -2096,7 +2108,7 @@ class Operation(
).distinct("location", "index")
return q
- def get_extra_actions(self, request):
+ def get_extra_actions(self, request, window_id=None):
"""
For sheet template
"""
@@ -2160,6 +2172,16 @@ class Operation(
True,
),
]
+ actions += [
+ (
+ reverse("operation-site-relations-modify", args=[self.pk, window_id]),
+ _("Modify operation-site relations"),
+ "fa fa-retweet",
+ profile.get_site_label("plural").lower(),
+ "",
+ True,
+ ),
+ ]
if can_edit_operation:
actions += [