mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
RelatedField.get_default_value: return empty list if self.many==True
This commit is contained in:
parent
1addd09e2b
commit
3c62f0efc3
|
@ -122,8 +122,9 @@ class RelatedField(WritableField):
|
|||
|
||||
def get_default_value(self):
|
||||
default = super(RelatedField, self).get_default_value()
|
||||
return default or \
|
||||
[] if self.many else None
|
||||
if self.many and default is None:
|
||||
return []
|
||||
return default
|
||||
|
||||
### Regular serializer stuff...
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user