mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 17:09:59 +03:00
Allow for SerializerMethodField to raise SkipField
This commit is contained in:
parent
7bd730124c
commit
73aeacbc6b
|
@ -511,7 +511,10 @@ class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
|
|||
if check_for_none is None:
|
||||
ret[field.field_name] = None
|
||||
else:
|
||||
try:
|
||||
ret[field.field_name] = field.to_representation(attribute)
|
||||
except SkipField:
|
||||
continue
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user