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.
|
||||
|
||||
"""
|
||||
for baseclass in inspect.getmro(obj.__class__):
|
||||
val = mapping.get(baseclass)
|
||||
if val:
|
||||
return val
|
||||
return None
|
||||
return next(
|
||||
(mapping[cls] for cls in inspect.getmro(obj.__class__) if cls in mapping),
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
class ModelSerializer(Serializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user