Added a patch for tastypie under django 2.2, to catch field error exceptions that were handled differently under earlier django versions.
- Legacy-Id: 18407
This commit is contained in:
parent
8d2e0a0637
commit
bb9bd8d469
|
@ -1137,6 +1137,7 @@ CHECKS_LIBRARY_PATCHES_TO_APPLY = [
|
|||
'patch/fix-django-password-strength-kwargs.patch',
|
||||
'patch/add-django-http-cookie-value-none.patch',
|
||||
'patch/django-cookie-delete-with-all-settings.patch',
|
||||
'patch/tastypie-django22-fielderror-response.patch',
|
||||
]
|
||||
if DEBUG:
|
||||
try:
|
||||
|
|
20
patch/tastypie-django22-fielderror-response.patch
Normal file
20
patch/tastypie-django22-fielderror-response.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- tastypie/resources.py.orig 2020-08-24 13:14:25.463166100 +0200
|
||||
+++ tastypie/resources.py 2020-08-24 13:15:55.133759224 +0200
|
||||
@@ -15,7 +15,7 @@
|
||||
ObjectDoesNotExist, MultipleObjectsReturned, ValidationError, FieldDoesNotExist
|
||||
)
|
||||
from django.core.signals import got_request_exception
|
||||
-from django.core.exceptions import ImproperlyConfigured
|
||||
+from django.core.exceptions import ImproperlyConfigured, FieldError
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
try:
|
||||
from django.contrib.gis.db.models.fields import GeometryField
|
||||
@@ -2207,6 +2207,8 @@
|
||||
return self.authorized_read_list(objects, bundle)
|
||||
except ValueError:
|
||||
raise BadRequest("Invalid resource lookup data provided (mismatched type).")
|
||||
+ except FieldError as e:
|
||||
+ raise BadRequest("Invalid resource lookup: %s." % e)
|
||||
|
||||
def obj_get(self, bundle, **kwargs):
|
||||
"""
|
Loading…
Reference in a new issue