mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 13:14:30 +03:00
Rearrange code (#4908)
Minor refactor. Move assignment to after `None` check.
This commit is contained in:
parent
eacb93d453
commit
5986f95c8d
|
@ -1446,11 +1446,11 @@ class FileField(Field):
|
|||
return data
|
||||
|
||||
def to_representation(self, value):
|
||||
use_url = getattr(self, 'use_url', api_settings.UPLOADED_FILES_USE_URL)
|
||||
|
||||
if not value:
|
||||
return None
|
||||
|
||||
use_url = getattr(self, 'use_url', api_settings.UPLOADED_FILES_USE_URL)
|
||||
|
||||
if use_url:
|
||||
if not getattr(value, 'url', None):
|
||||
# If the file has not been saved it may not have a URL.
|
||||
|
|
Loading…
Reference in New Issue
Block a user