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