mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-21 14:05:16 +03:00
Fix private attributes ignore in documentation (#6601)
This commit is contained in:
parent
db65282163
commit
1ac0f63aa9
|
@ -965,7 +965,7 @@ The following class is an example of a generic serializer that can handle coerci
|
||||||
def to_representation(self, obj):
|
def to_representation(self, obj):
|
||||||
for attribute_name in dir(obj):
|
for attribute_name in dir(obj):
|
||||||
attribute = getattr(obj, attribute_name)
|
attribute = getattr(obj, attribute_name)
|
||||||
if attribute_name('_'):
|
if attribute_name.startswith('_'):
|
||||||
# Ignore private attributes.
|
# Ignore private attributes.
|
||||||
pass
|
pass
|
||||||
elif hasattr(attribute, '__call__'):
|
elif hasattr(attribute, '__call__'):
|
||||||
|
|
|
@ -523,7 +523,7 @@ The following class is an example of a generic serializer that can handle coerci
|
||||||
def to_representation(self, obj):
|
def to_representation(self, obj):
|
||||||
for attribute_name in dir(obj):
|
for attribute_name in dir(obj):
|
||||||
attribute = getattr(obj, attribute_name)
|
attribute = getattr(obj, attribute_name)
|
||||||
if attribute_name('_'):
|
if attribute_name.startswith('_'):
|
||||||
# Ignore private attributes.
|
# Ignore private attributes.
|
||||||
pass
|
pass
|
||||||
elif hasattr(attribute, '__call__'):
|
elif hasattr(attribute, '__call__'):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user