From 26f144130f0d2038ad42ae9f1b68b1ac9355c3a9 Mon Sep 17 00:00:00 2001 From: marcelkornblum Date: Wed, 19 Apr 2023 16:29:57 +0100 Subject: [PATCH 1/2] remove deprecxated is_ajax call --- wagtail_adminsortable/mixins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wagtail_adminsortable/mixins.py b/wagtail_adminsortable/mixins.py index 7feeb1d..f14eb11 100644 --- a/wagtail_adminsortable/mixins.py +++ b/wagtail_adminsortable/mixins.py @@ -11,14 +11,14 @@ class AjaxableResponseMixin(object): """ def form_invalid(self, form): response = super(AjaxableResponseMixin, self).form_invalid(form) - if self.request.is_ajax(): + if self.request.accepts("application/json"): return JsonResponse(form.errors, status=400) else: return response def form_valid(self, form): super(AjaxableResponseMixin, self).form_valid(form) - if self.request.is_ajax(): + if self.request.accepts("application/json"): objects = json.loads(self.request.POST.get('objects', '[]')) data = { 'message': 'success' From baa0d1f13a6bca4cc60e0d7dcd0522ecafcf5d67 Mon Sep 17 00:00:00 2001 From: marcelkornblum Date: Wed, 19 Apr 2023 16:50:57 +0100 Subject: [PATCH 2/2] bump version --- wagtail_adminsortable/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtail_adminsortable/__init__.py b/wagtail_adminsortable/__init__.py index 7fd229a..0404d81 100644 --- a/wagtail_adminsortable/__init__.py +++ b/wagtail_adminsortable/__init__.py @@ -1 +1 @@ -__version__ = '0.2.0' +__version__ = '0.3.0'