summaryrefslogtreecommitdiff
path: root/ishtar_common/models_rest.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-12-15 18:23:02 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:59 +0100
commita670bb7bfcc8aca51741b0c6137e110d6e298831 (patch)
treef512598dd83ecfdcb5eac2a830946edd8d1c2b42 /ishtar_common/models_rest.py
parente903a17e9ecc79c4f528d997957ed176c15bd60f (diff)
downloadIshtar-a670bb7bfcc8aca51741b0c6137e110d6e298831.tar.bz2
Ishtar-a670bb7bfcc8aca51741b0c6137e110d6e298831.zip
Syndication - filter field on sheet
Diffstat (limited to 'ishtar_common/models_rest.py')
-rw-r--r--ishtar_common/models_rest.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/ishtar_common/models_rest.py b/ishtar_common/models_rest.py
index 40398bca7..e16d37a90 100644
--- a/ishtar_common/models_rest.py
+++ b/ishtar_common/models_rest.py
@@ -2,7 +2,6 @@ import datetime
import os
import tempfile
-from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
@@ -34,6 +33,12 @@ MAIN_CONTENT_TYPES = APP_CONTENT_TYPES + [
("archaeological_warehouse", "container"),
]
+MAIN_MODELS = dict(
+ [(model_name, app_name) for app_name, model_name in MAIN_CONTENT_TYPES]
+)
+
+
+
class ApiUser(models.Model):
user_ptr = models.OneToOneField(
@@ -64,6 +69,18 @@ class ApiSearchModel(models.Model):
verbose_name_plural = _("API - Remote access - Search models")
+class ApiSheetFilter(models.Model):
+ api_search_model = models.ForeignKey(ApiSearchModel, on_delete=models.CASCADE)
+
+ class Meta:
+ verbose_name = _("API - Remote access - Sheet filter")
+ verbose_name_plural = _("API - Remote access - Sheet filters")
+
+ def get_template(self):
+ ct = self.api_search_model.content_type
+ return f"{ct.app_label}/templatestemplates/ishtar/sheet_{ct.model}.html"
+
+
class ApiExternalSource(models.Model):
url = models.URLField(verbose_name=_("URL"))
name = models.CharField(verbose_name=_("Name"), max_length=200)