mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
fix init method for image fields
This commit is contained in:
parent
74ac2d2489
commit
cc254f8873
|
@ -976,7 +976,7 @@ class FileField(WritableField):
|
|||
return data
|
||||
|
||||
def to_native(self, value):
|
||||
if self.show_url:
|
||||
if value and self.show_url:
|
||||
return value.url
|
||||
return value.name
|
||||
|
||||
|
@ -993,7 +993,6 @@ class ImageField(FileField):
|
|||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.show_url = kwargs.pop('show_url', False)
|
||||
super(ImageField, self).__init__(*args, **kwargs)
|
||||
|
||||
def from_native(self, data):
|
||||
|
|
Loading…
Reference in New Issue
Block a user