Skip to content

Commit

Permalink
Fix private attributes ignore in documentation (#6601)
Browse files Browse the repository at this point in the history
  • Loading branch information
delimitry authored and tomchristie committed Apr 21, 2019
1 parent db65282 commit 1ac0f63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/api-guide/serializers.md
Expand Up @@ -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__'):
Expand Down
2 changes: 1 addition & 1 deletion docs/community/3.0-announcement.md
Expand Up @@ -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__'):
Expand Down

0 comments on commit 1ac0f63

Please sign in to comment.