fix doc's for GET requisition

This commit is contained in:
Lucas Paim 2017-05-11 11:46:03 -03:00
parent afabebcaab
commit fb1b6dc472

View File

@ -564,8 +564,12 @@ class SchemaGenerator(object):
Return a list of `coreapi.Field` instances corresponding to any
request body input, as determined by the serializer class.
"""
if method not in ('PUT', 'GET', 'PATCH', 'POST'):
return []
if hasattr(view, 'action') and view.action == 'add_item':
pass
body_allowed_methods = ('PUT', 'PATCH', 'POST')
method_allow_body = method in body_allowed_methods
if not hasattr(view, 'get_serializer'):
return []
@ -592,6 +596,9 @@ class SchemaGenerator(object):
location = 'query' if isinstance(field, serializers.QueryParamField) else 'form'
if not method_allow_body and location != 'query':
continue
required = field.required and method != 'PATCH'
field = coreapi.Field(
name=field.field_name,