Not all File Objects have a .url attribute

This commit is contained in:
Aron Podrigal 2015-03-23 22:52:47 -04:00
parent 197027c87b
commit 010db598f6

View File

@ -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