summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-10-22 12:45:25 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:43:48 +0100
commitbe063a7032971db7c00a160595e69e1e67dd2c9f (patch)
tree2c18bedabd6a1afaafead68cf71b92dd2c439388 /ishtar_common/models_common.py
parent0b8933306e071f626af0ff2250bca962c1a03090 (diff)
downloadIshtar-be063a7032971db7c00a160595e69e1e67dd2c9f.tar.bz2
Ishtar-be063a7032971db7c00a160595e69e1e67dd2c9f.zip
✨ permissions refactoring: adapt admin pages
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index cd6c266ef..e92d7d55d 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -2626,7 +2626,7 @@ class GeoVectorData(Imported, OwnPerms):
if not precision and rounded:
precision = 6
- r = re.compile(r"(\d+)\.(\d{6})(\d*)")
+ # AFAC: r = re.compile(r"(\d+)\.(\d{6})(\d*)")
new_collection = []
for feat in collection:
geom_type = feat["geometry"].get("type", None)
@@ -3068,18 +3068,15 @@ class GeographicItem(models.Model):
class PermissionRequest(models.Model):
- name = models.CharField(_("Name"), max_length=200)
- slug = models.SlugField(_("Slug"), unique=True)
model = models.ForeignKey(ContentType, related_name="permissions",
verbose_name=_("Model"), on_delete=models.CASCADE)
+ name = models.CharField(_("Name"), max_length=200)
+ slug = models.SlugField(_("Slug"), unique=True)
request = models.TextField(
_("Request"), blank=True, null=False, default="",
help_text=_("Use 'text' request used in Ishtar search input")
)
- limit_to_attached_areas = models.BooleanField(
- _("Limit request to attached areas"), default=False,
- help_text=_("Request is limited to areas attached to the ishtar user")
- )
+ active = models.BooleanField(_("Active"), default=True)
include_associated_items = models.BooleanField(
_("Include associated items"), default=True,
help_text=_("All items associated items match the request")
@@ -3091,12 +3088,20 @@ class PermissionRequest(models.Model):
"For instance, match is done for all finds associated with own "
"context records")
)
- active = models.BooleanField(_("Active"), default=True)
+ limit_to_attached_areas = models.BooleanField(
+ _("Limit request to attached areas"), default=False,
+ help_text=_("Request is limited to areas attached to the ishtar user")
+ )
+
+ ADMIN_SECTION = _("Account")
class Meta:
verbose_name = _("Permission request")
verbose_name_plural = _("Permissions requests")
+ def __str__(self):
+ return f"{self.model} - {self.name}"
+
class SerializeItem:
SERIALIZE_EXCLUDE = ["search_vector"]