Commit e3c3d882 by Tom Christie

Merge pull request #3071 from antonyc/patch-1

Made exception message more verbose
parents 39ed03c2 47acec0f
......@@ -420,10 +420,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,
)
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment