mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-09 23:04:47 +03:00
Merge 130c7714e3
into d5178c9246
This commit is contained in:
commit
fc3b6b45c3
|
@ -260,12 +260,22 @@ class SchemaGenerator(object):
|
|||
if method not in ('PUT', 'PATCH', 'POST'):
|
||||
return []
|
||||
|
||||
if not hasattr(view, 'get_serializer_class'):
|
||||
serializer_class = None
|
||||
|
||||
# looking for serializer_class override
|
||||
if hasattr(callback, 'actions'):
|
||||
func = getattr(view, callback.actions[method.lower()])
|
||||
if 'serializer_class' in getattr(func, 'kwargs', ()):
|
||||
serializer_class = func.kwargs['serializer_class']
|
||||
|
||||
if serializer_class is None and hasattr(view, 'get_serializer_class'):
|
||||
serializer_class = view.get_serializer_class()
|
||||
|
||||
if serializer_class is None:
|
||||
return []
|
||||
|
||||
fields = []
|
||||
|
||||
serializer_class = view.get_serializer_class()
|
||||
serializer = serializer_class()
|
||||
|
||||
if isinstance(serializer, serializers.ListSerializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user