diff options
Diffstat (limited to 'docs/api-guide/content-negotiation.md')
| -rw-r--r-- | docs/api-guide/content-negotiation.md | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/docs/api-guide/content-negotiation.md b/docs/api-guide/content-negotiation.md index 2a774278..94dd59ca 100644 --- a/docs/api-guide/content-negotiation.md +++ b/docs/api-guide/content-negotiation.md @@ -54,6 +54,8 @@ The `select_renderer()` method should return a two-tuple of (renderer instance,  The following is a custom content negotiation class which ignores the client  request when selecting the appropriate parser or renderer. +    from rest_framework.negotiation import BaseContentNegotiation +      class IgnoreClientContentNegotiation(BaseContentNegotiation):          def select_parser(self, request, parsers):              """ @@ -77,6 +79,10 @@ The default content negotiation class may be set globally, using the `DEFAULT_CO  You can also set the content negotiation used for an individual view, or viewset, using the `APIView` class based views. +	from myapp.negotiation import IgnoreClientContentNegotiation +    from rest_framework.response import Response +    from rest_framework.views import APIView +      class NoNegotiationView(APIView):          """          An example view that does not perform content negotiation. | 
