From 8e6ddbc9a1a90a76b55e9dabb6b0c732e970cad2 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Mon, 15 Feb 2021 23:08:20 +0100
Subject: [PATCH] Generalise default callback name

---
 dj_iconify/views.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dj_iconify/views.py b/dj_iconify/views.py
index bc9c991..65c4156 100644
--- a/dj_iconify/views.py
+++ b/dj_iconify/views.py
@@ -10,13 +10,15 @@ from .types import IconifyJSON
 
 
 class BaseJSONView(View):
+    default_callback: str = "Console.log"
+
     def get_data(self, request: HttpRequest) -> dict:
         raise NotImplementedError("You must implement this method in your view.")
 
     def get(self, request: HttpRequest, format_: str = "json", *args, **kwargs) -> HttpResponse:
         # For JSONP, the callback name has to be passed
         if format_ == "js":
-            callback = request.GET.get("callback", "SimpleSVG._loaderCallback")
+            callback = request.GET.get("callback", self.default_callback)
 
         # Client can request pretty-printing of JSON
         if request.GET.get("pretty", "0").lower() in ("1", "true"):
@@ -60,6 +62,8 @@ class CollectionsView(BaseJSONView):
 
 class IconifyJSONView(BaseJSONView):
     """Serve the Iconify icon data retrieval API."""
+    default_callback: str = "SimpleSVG._loaderCallback"
+
     def get_data(self, request: HttpRequest, collection: str) -> dict:
         """Retrieve a set of icons using a GET request.
 
-- 
GitLab