summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/views_item.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 48d8e229b..23bc6dd44 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -1956,6 +1956,7 @@ DEFAULT_ROW_NUMBER = 10
# length is used by ajax DataTables requests
EXCLUDED_FIELDS = ["length"]
BASE_DATED_FIELDS = ["created", "last_modified"]
+RE_EXPORTER = re.compile(r"exporter-(\d+)")
def get_item(
@@ -2027,7 +2028,16 @@ def get_item(
if "json" in data_type:
EMPTY = "[]"
- if data_type not in ("json", "csv", "json-image", "json-map", "json-stats"):
+ m = RE_EXPORTER.match(data_type)
+ importer_type = None
+ if m:
+ importer_type_id = m.groups()[0]
+ q = models.ImporterType.objects.filter(id=importer_type)
+ if not q.count():
+ return HttpResponse(EMPTY, content_type="text/plain")
+ importer_type = q.all()[0]
+ data_type = "json"
+ elif data_type not in ("json", "csv", "json-image", "json-map", "json-stats"):
return HttpResponse(EMPTY, content_type="text/plain")
if data_type == "json-stats" and len(model.STATISTIC_MODALITIES) < 2:
@@ -2212,7 +2222,11 @@ def get_item(
try:
row_nb = int(request_items.get("length"))
except (ValueError, TypeError):
- row_nb = DEFAULT_ROW_NUMBER
+ if importer_type:
+ row_nb = None
+ no_limit = True
+ else:
+ row_nb = DEFAULT_ROW_NUMBER
if data_type == "json-map": # other limit for map
row_nb = settings.ISHTAR_MAP_MAX_ITEMS