mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Checking for a more specific exception when user might have passed in a list without specifying many=True.
This commit is contained in:
parent
30ce4c6413
commit
2b3d4a3783
|
@ -163,7 +163,7 @@ class BaseSerializer(Field):
|
||||||
if self.instance is not None and not getattr(self, '_errors', None):
|
if self.instance is not None and not getattr(self, '_errors', None):
|
||||||
try:
|
try:
|
||||||
self._data = self.to_representation(self.instance)
|
self._data = self.to_representation(self.instance)
|
||||||
except Exception as exc:
|
except AttributeError as exc:
|
||||||
if isinstance(self.instance, (list, tuple, QuerySet)):
|
if isinstance(self.instance, (list, tuple, QuerySet)):
|
||||||
msg = (
|
msg = (
|
||||||
'The reason for this exception might be that you '
|
'The reason for this exception might be that you '
|
||||||
|
|
Loading…
Reference in New Issue
Block a user