mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Generator implementation of class mapping.
This commit is contained in:
parent
582f6fdd4b
commit
e437520217
|
@ -633,11 +633,10 @@ def _get_class_mapping(mapping, obj):
|
||||||
from the dictionary or None.
|
from the dictionary or None.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for baseclass in inspect.getmro(obj.__class__):
|
return next(
|
||||||
val = mapping.get(baseclass)
|
(mapping[cls] for cls in inspect.getmro(obj.__class__) if cls in mapping),
|
||||||
if val:
|
None
|
||||||
return val
|
)
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class ModelSerializer(Serializer):
|
class ModelSerializer(Serializer):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user