def _sp_to_field(mcs, fields):
"""
Returns an ordered dictionary, which maps the source pointer of a
field to the field. Nested fields are listed before the parent.
"""
from aiohttp_json_api.fields.base import Relationship
result = OrderedDict()
for field in fields:
if isinstance(field, Relationship):
result.update(mcs._sp_to_field(field.links.values()))
result[field.sp] = field
return MappingProxyType(result)
评论列表
文章目录