mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
Metadata API should examine child serializer if passed parent ListSerializer. Closes #2035.
This commit is contained in:
parent
eafb7e1e24
commit
bb21216a7c
|
@ -96,6 +96,10 @@ class SimpleMetadata(BaseMetadata):
|
|||
Given an instance of a serializer, return a dictionary of metadata
|
||||
about its fields.
|
||||
"""
|
||||
if hasattr(serializer, 'child'):
|
||||
# If this is a `ListSerializer` then we want to examine the
|
||||
# underlying child serializer instance instead.
|
||||
serializer = serializer.child
|
||||
return OrderedDict([
|
||||
(field_name, self.get_field_info(field))
|
||||
for field_name, field in serializer.fields.items()
|
||||
|
|
Loading…
Reference in New Issue
Block a user