mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +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):
|
||||
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__'):
|
||||
|
|
|
@ -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__'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user