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' 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'