From a847560476e1f19c7b6be782b44842283b4d3517 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 9 May 2025 10:41:44 +0200 Subject: ✨ GIS API: manage GIS connections (list, request token, create token, delete) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/models_rest.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ishtar_common/models_rest.py') diff --git a/ishtar_common/models_rest.py b/ishtar_common/models_rest.py index e26968daf..f6b21a14a 100644 --- a/ishtar_common/models_rest.py +++ b/ishtar_common/models_rest.py @@ -58,6 +58,17 @@ class UserRequestToken(models.Model): verbose_name_plural = _("API - GIS - Request tokens") ADMIN_SECTION = _("API") + @property + def access_type_label(self): + if self.access_type in API_ACCESS_TYPES_DICT: + return API_ACCESS_TYPES_DICT[self.access_type] + return "" + + @property + def expiry(self): + timeout = timezone.now() - self.created + return settings.ISHTAR_REQUEST_TOKEN_TIMEOUT - timeout.seconds + @classmethod def clean_keys(cls): profile = get_current_profile() -- cgit v1.2.3