diff options
| author | Xavier Ordoquy | 2012-12-02 12:43:32 +0100 |
|---|---|---|
| committer | Xavier Ordoquy | 2012-12-02 12:43:32 +0100 |
| commit | 5fad46d7e213afed503b1533515cab96875a5936 (patch) | |
| tree | 72ab362e86a83ba53361613dbb1e7863889ea749 /docs/api-guide | |
| parent | fa53dde576c8733292eacf27c80cf7a0ad222c3b (diff) | |
| parent | 3114b4fa50e7aee296a0de17e7bcdc0753700ec3 (diff) | |
| download | django-rest-framework-5fad46d7e213afed503b1533515cab96875a5936.tar.bz2 | |
Merge remote-tracking branch 'reference/master' into p3k
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/authentication.md | 2 | ||||
| -rw-r--r-- | docs/api-guide/serializers.md | 4 | ||||
| -rw-r--r-- | docs/api-guide/views.md | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 8ed6ef31..43fc15d2 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -116,7 +116,7 @@ When using `TokenAuthentication`, you may want to provide a mechanism for client REST framework provides a built-in view to provide this behavior. To use it, add the `obtain_auth_token` view to your URLconf: urlpatterns += patterns('', - url(r'^api-token-auth/', 'rest_framework.authtoken.obtain_auth_token') + url(r'^api-token-auth/', 'rest_framework.authtoken.views.obtain_auth_token') ) Note that the URL part of the pattern can be whatever you want to use. diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 048c1200..19efde3c 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -77,6 +77,10 @@ When deserializing data, we can either create a new instance, or update an exist serializer = CommentSerializer(data=data) # Create new instance serializer = CommentSerializer(comment, data=data) # Update `instance` +By default, serializers must be passed values for all required fields or they will throw validation errors. You can use the `partial` argument in order to allow partial updates. + + serializer = CommentSerializer(comment, data={'content': u'foo bar'}, partial=True) # Update `instance` with partial data + ## Validation When deserializing data, you always need to call `is_valid()` before attempting to access the deserialized object. If any validation errors occur, the `.errors` and `.non_field_errors` properties will contain the resulting error messages. diff --git a/docs/api-guide/views.md b/docs/api-guide/views.md index 5b072827..d1e42ec1 100644 --- a/docs/api-guide/views.md +++ b/docs/api-guide/views.md @@ -19,6 +19,10 @@ Using the `APIView` class is pretty much the same as using a regular `View` clas For example: + from rest_framework.views import APIView + from rest_framework.response import Response + from rest_framework import authentication, permissions + class ListUsers(APIView): """ View to list all users in the system. |
