mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Fix assert messaging on fields/exclude checking. Closes #833
This commit is contained in:
parent
d199a89c18
commit
d62414147f
|
@ -200,7 +200,7 @@ class BaseSerializer(WritableField):
|
|||
|
||||
# If 'fields' is specified, use those fields, in that order.
|
||||
if self.opts.fields:
|
||||
assert isinstance(self.opts.fields, (list, tuple)), '`include` must be a list or tuple'
|
||||
assert isinstance(self.opts.fields, (list, tuple)), '`fields` must be a list or tuple'
|
||||
new = SortedDict()
|
||||
for key in self.opts.fields:
|
||||
new[key] = ret[key]
|
||||
|
@ -208,7 +208,7 @@ class BaseSerializer(WritableField):
|
|||
|
||||
# Remove anything in 'exclude'
|
||||
if self.opts.exclude:
|
||||
assert isinstance(self.opts.fields, (list, tuple)), '`exclude` must be a list or tuple'
|
||||
assert isinstance(self.opts.exclude, (list, tuple)), '`exclude` must be a list or tuple'
|
||||
for key in self.opts.exclude:
|
||||
ret.pop(key, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user