mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Show class name in exception message
This commit is contained in:
parent
3e6f99e273
commit
ec4d79bcaf
|
@ -425,7 +425,8 @@ class ModelSerializer(Serializer):
|
|||
|
||||
cls = self.opts.model
|
||||
if cls is None:
|
||||
raise AttributeError("Serializer class is missing 'model' Meta option")
|
||||
raise AttributeError("Serializer class '%s' is missing 'model' Meta option" %
|
||||
self.__class__.__name__)
|
||||
opts = get_concrete_model(cls)._meta
|
||||
pk_field = opts.pk
|
||||
# while pk_field.rel:
|
||||
|
|
|
@ -366,7 +366,7 @@ class ValidationTests(TestCase):
|
|||
try:
|
||||
serializer = BrokenModelSerializer()
|
||||
except AttributeError as e:
|
||||
self.assertEquals(e.args[0], "Serializer class is missing 'model' Meta option")
|
||||
self.assertEquals(e.args[0], "Serializer class 'BrokenModelSerializer' is missing 'model' Meta option")
|
||||
except:
|
||||
self.fail('Wrong exception type thrown.')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user