From 12e9870e2aa0659de98a9122fbc4ab16b0877449 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 16 Sep 2024 12:45:00 +0200 Subject: ✨ Context records relations: remove form from the wizard to put in a specific form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_context_records/models.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'archaeological_context_records/models.py') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index ee43183eb..3867997de 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1056,9 +1056,10 @@ class ContextRecord( 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) + actions = super().get_extra_actions(request) + is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) - # is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) + can_edit_cr = self.can_do(request, "change_contextrecord") profile = get_current_profile() can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata") if can_add_geo: @@ -1075,7 +1076,18 @@ class ContextRecord( False, ), ] - can_edit_cr = self.can_do(request, "change_contextrecord") + if can_edit_cr and not is_locked: + actions += [ + ( + reverse("context-record-relation-modify", args=[self.pk]), + _("Modify relations"), + "fa fa-retweet", + _("relations"), + "", + True, + ), + ] + if can_edit_cr: actions += [ ( -- cgit v1.2.3