mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 21:40:13 +03:00
Not all File Objects have a .url attribute
This commit is contained in:
parent
197027c87b
commit
010db598f6
|
@ -1106,7 +1106,7 @@ class FileField(Field):
|
|||
return data
|
||||
|
||||
def to_representation(self, value):
|
||||
if self.use_url:
|
||||
if self.use_url and hasattr(value, 'url'):
|
||||
if not value:
|
||||
return None
|
||||
url = value.url
|
||||
|
|
Loading…
Reference in New Issue
Block a user