diff options
| author | Tom Christie | 2013-07-04 05:50:04 -0700 |
|---|---|---|
| committer | Tom Christie | 2013-07-04 05:50:04 -0700 |
| commit | 99794773cf6b865b5b860b35db31dea92968c605 (patch) | |
| tree | 157b09d6b19ee5583d6d32123b3671c1c75adbc9 /rest_framework/renderers.py | |
| parent | a890116ab31e57af3bd1382c1f17259fa368f988 (diff) | |
| parent | 7398464b397d37dbcfda13eb6142039fed3e9a19 (diff) | |
| download | django-rest-framework-99794773cf6b865b5b860b35db31dea92968c605.tar.bz2 | |
Merge pull request #962 from tomchristie/test-client
APIClient and APIRequestFactory
Diffstat (limited to 'rest_framework/renderers.py')
| -rw-r--r-- | rest_framework/renderers.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 8b2428ad..3a03ca33 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -14,6 +14,7 @@ from django import forms from django.core.exceptions import ImproperlyConfigured from django.http.multipartparser import parse_header from django.template import RequestContext, loader, Template +from django.test.client import encode_multipart from django.utils.xmlutils import SimplerXMLGenerator from rest_framework.compat import StringIO from rest_framework.compat import six @@ -571,3 +572,13 @@ class BrowsableAPIRenderer(BaseRenderer): response.status_code = status.HTTP_200_OK return ret + + +class MultiPartRenderer(BaseRenderer): + media_type = 'multipart/form-data; boundary=BoUnDaRyStRiNg' + format = 'multipart' + charset = 'utf-8' + BOUNDARY = 'BoUnDaRyStRiNg' + + def render(self, data, accepted_media_type=None, renderer_context=None): + return encode_multipart(self.BOUNDARY, data) |
