summaryrefslogtreecommitdiff
path: root/ishtar_common/models_rest.py
diff options
context:
space:
mode:
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)