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 return data
def to_representation(self, value): def to_representation(self, value):
if self.use_url: if self.use_url and hasattr(value, 'url'):
if not value: if not value:
return None return None
url = value.url url = value.url