diff options
| author | Sébastien Piquemal | 2012-02-07 16:22:14 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-07 16:22:14 +0200 |
| commit | 6963fd3623ee217fe489abb25f0ffa8c0781e4cd (patch) | |
| tree | 1ab2bbaf166a65eff015820fac96e6e90a39bb07 /docs/howto | |
| parent | 21292d31e7ad5ec731c9ef3e471f90cb29054686 (diff) | |
| download | django-rest-framework-6963fd3623ee217fe489abb25f0ffa8c0781e4cd.tar.bz2 | |
some docs for Request/Response/mixins
Diffstat (limited to 'docs/howto')
| -rw-r--r-- | docs/howto/requestmixin.rst | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/howto/requestmixin.rst b/docs/howto/requestmixin.rst index a00fdad0..c0aadb3f 100644 --- a/docs/howto/requestmixin.rst +++ b/docs/howto/requestmixin.rst @@ -1,7 +1,7 @@ Using the enhanced request in all your views ============================================== -This example shows how you can use Django REST framework's enhanced `request` in your own views, without having to use the full-blown :class:`views.View` class. +This example shows how you can use Django REST framework's enhanced `request` - :class:`request.Request` - in your own views, without having to use the full-blown :class:`views.View` class. What can it do for you ? Mostly, it will take care of parsing the request's content, and handling equally all HTTP methods ... @@ -64,13 +64,12 @@ Now that you're convinced you need to use the enhanced request object, here is h Base view enabling the usage of enhanced requests with user defined views. """ - parsers = parsers.DEFAULT_PARSERS + parser_classes = parsers.DEFAULT_PARSERS def dispatch(self, request, *args, **kwargs): - self.request = request - request = self.get_request() + request = self.prepare_request(request) return super(MyBaseViewUsingEnhancedRequest, self).dispatch(request, *args, **kwargs) And then, use this class as a base for all your custom views. -.. note:: you can also check the request example. +.. note:: you can see this live in the examples. |
