mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
Merge 76c5338930
into 991868a897
This commit is contained in:
commit
b09f375b0a
|
@ -291,15 +291,17 @@ class AutoSchema(ViewInspector):
|
|||
request body input, as determined by the serializer class.
|
||||
"""
|
||||
view = self.view
|
||||
|
||||
if method not in ('PUT', 'PATCH', 'POST'):
|
||||
return []
|
||||
|
||||
if not hasattr(view, 'get_serializer'):
|
||||
if not hasattr(view, 'get_serializer') and not hasattr(view, 'serializer_class'):
|
||||
return []
|
||||
|
||||
try:
|
||||
if hasattr(view, 'get_serializer'):
|
||||
serializer = view.get_serializer()
|
||||
elif hasattr(view, 'serializer_class'):
|
||||
serializer = view.serializer_class()
|
||||
except exceptions.APIException:
|
||||
serializer = None
|
||||
warnings.warn('{}.get_serializer() raised an exception during '
|
||||
|
|
Loading…
Reference in New Issue
Block a user