diff --git a/.gitignore b/.gitignore index 4947943af..312b28df9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ MANIFEST .coverage .tox .DS_Store +.idea/* \ No newline at end of file diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 5f19c521b..f4c8dcb40 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -167,3 +167,9 @@ class MultiPartParser(BaseParser): {'detail': 'multipart parse error - %s' % unicode(exc)}) return django_parser.parse() +DEFAULT_PARSERS = ( parsers.JSONParser, + parsers.FormParser, + parsers.MultiPartParser ) + +if YAMLParser: + DEFAULT_PARSERS += (YAMLParser,) diff --git a/djangorestframework/views.py b/djangorestframework/views.py index eea3b97ad..c25bb88f6 100644 --- a/djangorestframework/views.py +++ b/djangorestframework/views.py @@ -44,9 +44,7 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView): """ List of parsers the resource can parse the request with. """ - parsers = ( parsers.JSONParser, - parsers.FormParser, - parsers.MultiPartParser ) + parsers = parsers.DEFAULT_PARSERS """ List of all authenticating methods to attempt.