mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Made exception message more verbose
This exception helps you to upgrade from 2 -> 3 and since a lot of fields may be in 2 using serializers.Field as parent class, this message should contain at least name of upgraded field to help user to grep and fix the codebase faster.
This commit is contained in:
parent
a17270589c
commit
47acec0f9d
|
@ -417,10 +417,11 @@ class Field(object):
|
|||
Transform the *outgoing* native value into primitive data.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
'{cls}.to_representation() must be implemented.\n'
|
||||
'{cls}.to_representation() must be implemented for field {field_name}.\n'
|
||||
'If you are upgrading from REST framework version 2 '
|
||||
'you might want `ReadOnlyField`.'.format(
|
||||
cls=self.__class__.__name__
|
||||
cls=self.__class__.__name__,
|
||||
field_name=self.field_name,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user