fixes: response data stays persistent throughout views

This commit is contained in:
Matthias 2021-06-20 18:52:55 +02:00
parent b4412ef575
commit a3517b9313

View File

@ -337,7 +337,7 @@ class AjaxMixin(InvenTreeRoleMixin):
# Do nothing by default
pass
def renderJsonResponse(self, request, form=None, data={}, context=None):
def renderJsonResponse(self, request, form=None, data=None, context=None):
""" Render a JSON response based on specific class context.
Args:
@ -349,6 +349,9 @@ class AjaxMixin(InvenTreeRoleMixin):
Returns:
JSON response object
"""
# a empty dict as default can be dangerous - set it here if empty
if not data:
data = {}
if not request.is_ajax():
return HttpResponseRedirect('/')