Fix private attributes ignore in documentation (#6601)

This commit is contained in:
Dmitry Alimov 2019-04-21 19:27:13 +03:00 committed by Tom Christie
parent db65282163
commit 1ac0f63aa9
2 changed files with 2 additions and 2 deletions

View File

@ -965,7 +965,7 @@ The following class is an example of a generic serializer that can handle coerci
def to_representation(self, obj):
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
if attribute_name('_'):
if attribute_name.startswith('_'):
# Ignore private attributes.
pass
elif hasattr(attribute, '__call__'):

View File

@ -523,7 +523,7 @@ The following class is an example of a generic serializer that can handle coerci
def to_representation(self, obj):
for attribute_name in dir(obj):
attribute = getattr(obj, attribute_name)
if attribute_name('_'):
if attribute_name.startswith('_'):
# Ignore private attributes.
pass
elif hasattr(attribute, '__call__'):