diff --git a/rest_framework/fields.py b/rest_framework/fields.py index a80862e8c8..085706c468 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1106,7 +1106,7 @@ def to_internal_value(self, data): 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
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: