mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 11:30:12 +03:00
fields.get_attribute: return None for FK lookups
Ref: https://github.com/encode/django-rest-framework/pull/5708#issuecomment-355569737
This commit is contained in:
parent
247cf096d4
commit
0a77ff652f
|
@ -98,6 +98,8 @@ def get_attribute(instance, attrs):
|
|||
instance = instance[attr]
|
||||
else:
|
||||
instance = getattr(instance, attr)
|
||||
if instance is None:
|
||||
return None
|
||||
except ObjectDoesNotExist:
|
||||
return None
|
||||
if is_simple_callable(instance):
|
||||
|
|
Loading…
Reference in New Issue
Block a user