mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
class name added to unkown field error (#9019)
This commit is contained in:
parent
7658ffd71d
commit
5c3b6e496c
|
@ -1372,8 +1372,8 @@ class ModelSerializer(Serializer):
|
|||
Raise an error on any unknown fields.
|
||||
"""
|
||||
raise ImproperlyConfigured(
|
||||
'Field name `%s` is not valid for model `%s`.' %
|
||||
(field_name, model_class.__name__)
|
||||
'Field name `%s` is not valid for model `%s` in `%s.%s`.' %
|
||||
(field_name, model_class.__name__, self.__class__.__module__, self.__class__.__name__)
|
||||
)
|
||||
|
||||
def include_extra_kwargs(self, kwargs, extra_kwargs):
|
||||
|
|
|
@ -315,7 +315,8 @@ class TestRegularFieldMappings(TestCase):
|
|||
model = RegularFieldsModel
|
||||
fields = ('auto_field', 'invalid')
|
||||
|
||||
expected = 'Field name `invalid` is not valid for model `RegularFieldsModel`.'
|
||||
expected = 'Field name `invalid` is not valid for model `RegularFieldsModel` ' \
|
||||
'in `tests.test_model_serializer.TestSerializer`.'
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, expected):
|
||||
TestSerializer().fields
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user