diff options
| -rw-r--r-- | docs/api-guide/permissions.md | 2 | ||||
| -rw-r--r-- | docs/tutorial/2-requests-and-responses.md | 2 | ||||
| -rw-r--r-- | rest_framework/fields.py | 14 |
3 files changed, 14 insertions, 4 deletions
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index f068f0f7..ddcefadb 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -104,7 +104,7 @@ This permission is suitable if you want your API to only be accessible to regist The `IsAdminUser` permission class will deny permission to any user, unless `user.is_staff` is `True` in which case permission will be allowed. -This permission is suitable is you want your API to only be accessible to a subset of trusted administrators. +This permission is suitable if you want your API to only be accessible to a subset of trusted administrators. ## IsAuthenticatedOrReadOnly diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md index 49e96d03..c0426969 100644 --- a/docs/tutorial/2-requests-and-responses.md +++ b/docs/tutorial/2-requests-and-responses.md @@ -181,7 +181,7 @@ Similarly, we can control the format of the request that we send, using the `Con "id": 4, "title": "", "code": "print 456", - "linenos": true, + "linenos": false, "language": "python", "style": "friendly" } diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 1a4712d8..f3e17b18 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -386,13 +386,23 @@ class Field(object): """ Transform the *incoming* primitive data into a native value. """ - raise NotImplementedError('to_internal_value() must be implemented.') + raise NotImplementedError( + '{cls}.to_internal_value() must be implemented.'.format( + cls=self.__class__.__name__ + ) + ) def to_representation(self, value): """ Transform the *outgoing* native value into primitive data. """ - raise NotImplementedError('to_representation() must be implemented.') + raise NotImplementedError( + '{cls}.to_representation() must be implemented.\n' + 'If you are upgrading from REST framework version 2 ' + 'you might want `ReadOnlyField`.'.format( + cls=self.__class__.__name__ + ) + ) def fail(self, key, **kwargs): """ |
