diff --git a/dj_iconify/views.py b/dj_iconify/views.py index bc9c9916cf3489b1abdbc31943d35f42c01e949e..65c4156c155a4bbd1161e976d86478287297b60d 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.