diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-02-22 13:35:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-02-22 13:35:49 +0100 |
commit | cd17dd8715a846cccee3ada897b8774a9985f1ff (patch) | |
tree | b19a8c348c3de810612e75c655491a586a3cefc7 /archaeological_files/models.py | |
parent | 1a2d320457700d7a83895807b677262dd193aaed (diff) | |
download | Ishtar-cd17dd8715a846cccee3ada897b8774a9985f1ff.tar.bz2 Ishtar-cd17dd8715a846cccee3ada897b8774a9985f1ff.zip |
File: filter plan action when preventive_operator is activated in profile
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r-- | archaeological_files/models.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 529e3e0e6..d81433a25 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -29,7 +29,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator from django.db.models import Q, Count, Sum, Max from django.db.models.signals import post_save, m2m_changed, post_delete from django.urls import reverse -from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy +from ishtar_common.utils import ugettext_lazy as _, pgettext_lazy, get_current_profile from ishtar_common.utils import ( cached_label_changed, @@ -1241,7 +1241,8 @@ class File( True, ), ] - if self.can_do(request, "add_administrativeact"): + profile = get_current_profile() + if profile.preventive_operator: actions += [ ( reverse("file-edit-preventive", args=[self.pk]), @@ -1251,6 +1252,9 @@ class File( "", False, ), + ] + if self.can_do(request, "add_administrativeact"): + actions += [ ( reverse("file-add-adminact", args=[self.pk]), _("Add associated administrative act"), |