From e76f56a3d687159327b8bef5bf9bc2ad28c99ea3 Mon Sep 17 00:00:00 2001 From: "S. Andrew Sheppard" Date: Wed, 10 Sep 2014 11:55:43 -0500 Subject: [PATCH 01/14] add django rest pandas --- docs/api-guide/renderers.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index 7a3429bfd..20eed70d6 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -444,6 +444,11 @@ Comma-separated values are a plain-text tabular data format, that can be easily [djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework. This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names. It is maintained by [Vitaly Babiy][vbabiy]. +## Pandas (CSV, Excel, PNG) + +[Django REST Pandas] provides a serializer and renderers that support additional data processing and output via the [Pandas] DataFrame API. Django REST Pandas includes renderers for Pandas-style CSV files, Excel workbooks (both `.xls` and `.xlsx`), and a number of [other formats]. It is maintained by [S. Andrew Sheppard][sheppard] as part of the [wq Project][wq]. + + [cite]: https://docs.djangoproject.com/en/dev/ref/template-response/#the-rendering-process [conneg]: content-negotiation.md [browser-accept-headers]: http://www.gethifi.com/blog/browser-rest-http-accept-headers @@ -466,4 +471,9 @@ Comma-separated values are a plain-text tabular data format, that can be easily [ultrajson]: https://github.com/esnme/ultrajson [hzy]: https://github.com/hzy [drf-ujson-renderer]: https://github.com/gizmag/drf-ujson-renderer -[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case \ No newline at end of file +[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case +[Django REST Pandas]: https://github.com/wq/django-rest-pandas +[Pandas]: http://pandas.pydata.org/ +[other formats]: https://github.com/wq/django-rest-pandas#supported-formats +[sheppard]: https://github.com/sheppard +[wq]: https://github.com/wq From 37d01f6088b1cf5673f66f4532dd51c73a0156f1 Mon Sep 17 00:00:00 2001 From: Joe Binney Date: Wed, 10 Sep 2014 20:27:52 -0700 Subject: [PATCH 02/14] Fix grammar in login error message --- rest_framework/authtoken/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/authtoken/serializers.py b/rest_framework/authtoken/serializers.py index 99e99ae3d..472e59ee3 100644 --- a/rest_framework/authtoken/serializers.py +++ b/rest_framework/authtoken/serializers.py @@ -22,7 +22,7 @@ class AuthTokenSerializer(serializers.Serializer): attrs['user'] = user return attrs else: - msg = _('Unable to login with provided credentials.') + msg = _('Unable to log in with provided credentials.') raise serializers.ValidationError(msg) else: msg = _('Must include "username" and "password"') From ae8443853054635326598f6b06fb49429884d558 Mon Sep 17 00:00:00 2001 From: Marek Skrajnowski Date: Thu, 11 Sep 2014 12:42:36 +0200 Subject: [PATCH 03/14] Added DefaultRouter support (and test) for viewsets without the default action implemented, which is usually the list action. --- rest_framework/routers.py | 11 ++++++++++- tests/test_routers.py | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 8f1ab6fa7..01fd4b91a 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -19,6 +19,7 @@ import itertools from collections import namedtuple from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured +from django.core.urlresolvers import NoReverseMatch from rest_framework import views from rest_framework.response import Response from rest_framework.reverse import reverse @@ -287,7 +288,15 @@ class DefaultRouter(SimpleRouter): def get(self, request, *args, **kwargs): ret = {} for key, url_name in api_root_dict.items(): - ret[key] = reverse(url_name, request=request, format=kwargs.get('format', None)) + try: + ret[key] = reverse( + url_name, + request=request, + format=kwargs.get('format', None) + ) + except NoReverseMatch: + continue + return Response(ret) return APIRoot.as_view() diff --git a/tests/test_routers.py b/tests/test_routers.py index b076f134e..f6f5a977a 100644 --- a/tests/test_routers.py +++ b/tests/test_routers.py @@ -3,7 +3,7 @@ from django.conf.urls import patterns, url, include from django.db import models from django.test import TestCase from django.core.exceptions import ImproperlyConfigured -from rest_framework import serializers, viewsets, permissions +from rest_framework import serializers, viewsets, mixins, permissions from rest_framework.decorators import detail_route, list_route from rest_framework.response import Response from rest_framework.routers import SimpleRouter, DefaultRouter @@ -284,3 +284,19 @@ class TestDynamicListAndDetailRouter(TestCase): else: method_map = 'get' self.assertEqual(route.mapping[method_map], endpoint) + + +class TestRootWithAListlessViewset(TestCase): + def setUp(self): + class NoteViewSet(mixins.RetrieveModelMixin, + viewsets.GenericViewSet): + model = RouterTestModel + + self.router = DefaultRouter() + self.router.register(r'notes', NoteViewSet) + self.view = self.router.urls[0].callback + + def test_api_root(self): + request = factory.get('/') + response = self.view(request) + self.assertEqual(response.data, {}) From 96c21b81f5031a81b42b89371af48677081a6323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Sat, 13 Sep 2014 13:53:40 -0400 Subject: [PATCH 04/14] Add Third Party Resources Topic section --- docs/index.md | 4 +- docs/template.html | 1 + docs/topics/third-party-resources.md | 87 ++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 docs/topics/third-party-resources.md diff --git a/docs/index.md b/docs/index.md index 1888bfe4b..6dcb962f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -195,6 +195,7 @@ General guides to using REST framework. * [Browser enhancements][browser-enhancements] * [The Browsable API][browsableapi] * [REST, Hypermedia & HATEOAS][rest-hypermedia-hateoas] +* [Third Party Resources][third-party-resources] * [Contributing to REST framework][contributing] * [2.0 Announcement][rest-framework-2-announcement] * [2.2 Announcement][2.2-announcement] @@ -312,11 +313,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [browsableapi]: topics/browsable-api.md [rest-hypermedia-hateoas]: topics/rest-hypermedia-hateoas.md [contributing]: topics/contributing.md +[third-party-resources]: topics/third-party-resources.md [rest-framework-2-announcement]: topics/rest-framework-2-announcement.md [2.2-announcement]: topics/2.2-announcement.md [2.3-announcement]: topics/2.3-announcement.md [2.4-announcement]: topics/2.4-announcement.md -[kickstarter-announcement]: topics/kickstarter-announcement.md +[kickstarter-announcement]: topics/kickstarter-announcement.md [release-notes]: topics/release-notes.md [credits]: topics/credits.md diff --git a/docs/template.html b/docs/template.html index 19542bfe6..bb3ae221a 100644 --- a/docs/template.html +++ b/docs/template.html @@ -117,6 +117,7 @@ a.fusion-poweredby {
  • Browser enhancements
  • The Browsable API
  • REST, Hypermedia & HATEOAS
  • +
  • Third Party Resources
  • Contributing to REST framework
  • 2.0 Announcement
  • 2.2 Announcement
  • diff --git a/docs/topics/third-party-resources.md b/docs/topics/third-party-resources.md new file mode 100644 index 000000000..da92eb33a --- /dev/null +++ b/docs/topics/third-party-resources.md @@ -0,0 +1,87 @@ +# Third Party Resources + +Django REST Framework has a growing community of developers, packages, and resources. + +Check out a grid detailing all the packages and ecosystem around Django REST Framework at [Django Packages](https://www.djangopackages.com/grids/g/django-rest-framework/). + +## Libraries and Extensions + +### Authentication + +* [djangorestframework-digestauth](https://github.com/juanriaza/django-rest-framework-digestauth) - Provides Digest Access Authentication support. +* [django-oauth-toolkit](https://github.com/evonove/django-oauth-toolkit) - Provides OAuth 2.0 support. +* [doac](https://github.com/Rediker-Software/doac) - Provides OAuth 2.0 support. +* [djangorestframework-jwt](https://github.com/GetBlimp/django-rest-framework-jwt) - Provides JSON Web Token Authentication support. +* [hawkrest](https://github.com/kumar303/hawkrest) - Provides Hawk HTTP Authorization. +* [djangorestframework-httpsignature](https://github.com/etoccalino/django-rest-framework-httpsignature) - Provides an easy to use HTTP Signature Authentication mechanism. + +### Permissions + +* [drf-any-permissions](https://github.com/kevin-brown/drf-any-permissions) - Provides alternative permission handling. +* [djangorestframework-composed-permissions](https://github.com/niwibe/djangorestframework-composed-permissions) - Provides a simple way to define complex permissions. +* [rest_condition](https://github.com/caxap/rest_condition) - Another extension for building complex permissions in a simple and convenient way. + +### Serializers + +* [django-rest-framework-mongoengine](https://github.com/umutbozkurt/django-rest-framework-mongoengine) - Serializer class that supports using MongoDB as the storage layer for Django REST framework. +* [djangorestframework-gis](https://github.com/djangonauts/django-rest-framework-gis) - Geographic add-ons +* [djangorestframework-hstore](https://github.com/djangonauts/django-rest-framework-hstore) - Serializer class to support django-hstore DictionaryField model field and its schema-mode feature. + +### Serializer fields + +* [drf-compound-fields](https://github.com/estebistec/drf-compound-fields) - Provides "compound" serializer fields, such as lists of simple values. +* [django-extra-fields](https://github.com/Hipo/drf-extra-fields) - Provides extra serializer fields. + +### Views + +* [djangorestframework-bulk](https://github.com/miki725/django-rest-framework-bulk) - Implements generic view mixins as well as some common concrete generic views to allow to apply bulk operations via API requests. + +### Routers + +* [drf-nested-routers](https://github.com/alanjds/drf-nested-routers) - Provides routers and relationship fields for working with nested resources. + +### Parsers + +* [djangorestframework-msgpack](https://github.com/juanriaza/django-rest-framework-msgpack) - Provides MessagePack renderer and parser support. +* [djangorestframework-camel-case](https://github.com/vbabiy/djangorestframework-camel-case) - Provides camel case JSON renderers and parsers. + +### Renderers + +* [djangorestframework-csv](https://github.com/mjumbewu/django-rest-framework-csv) - Provides CSV renderer support. +* [drf_ujson](https://github.com/gizmag/drf-ujson-renderer) - Implements JSON rendering using the UJSON package. + +### Filtering + +* [djangorestframework-chain](https://github.com/philipn/django-rest-framework-chain) - Allows arbitrary chaining of both relations and lookup filters. + +### Misc + +* [djangorestrelationalhyperlink](https://github.com/fredkingham/django_rest_model_hyperlink_serializers_project) - A hyperlinked serialiser that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer. +* [django-rest-swagger](https://github.com/marcgibbons/django-rest-swagger) - An API documentation generator for Swagger UI. +* [django-rest-framework-proxy ](https://github.com/eofs/django-rest-framework-proxy) - Proxy to redirect incoming request to another API server. +* [gaiarestframework](https://github.com/AppsFuel/gaiarestframework) - Utils for django-rest-framewok +* [drf-extensions](https://github.com/chibisov/drf-extensions) - A collection of custom extensions +* [ember-data-django-rest-adapter](https://github.com/toranb/ember-data-django-rest-adapter) - An ember-data adapter + +## Tutorials + +* [Beginner's Guide to the Django Rest Framework](http://code.tutsplus.com/tutorials/beginners-guide-to-the-django-rest-framework--cms-19786) +* [Getting Started with Django Rest Framework and AngularJS](http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html) +* [End to end web app with Django-Rest-Framework & AngularJS](http://blog.mourafiq.com/post/55034504632/end-to-end-web-app-with-django-rest-framework) +* [Start Your API - django-rest-framework part 1](https://godjango.com/41-start-your-api-django-rest-framework-part-1/) +* [Permissions & Authentication - django-rest-framework part 2](https://godjango.com/43-permissions-authentication-django-rest-framework-part-2/) +* [ViewSets and Routers - django-rest-framework part 3](https://godjango.com/45-viewsets-and-routers-django-rest-framework-part-3/) +* [Django Rest Framework User Endpoint](http://richardtier.com/2014/02/25/django-rest-framework-user-endpoint/) +* [Check credentials using Django Rest Framework](http://richardtier.com/2014/03/06/110/) + +## Videos + +* [Ember and Django Part 1 (Video)](http://www.neckbeardrepublic.com/screencasts/ember-and-django-part-1) +* [Django Rest Framework Part 1 (Video)](http://www.neckbeardrepublic.com/screencasts/django-rest-framework-part-1) +* [Pyowa July 2013 - Django Rest Framework (Video)](http://www.youtube.com/watch?v=E1ZrehVxpBo) +* [django-rest-framework and angularjs (Video)](http://www.youtube.com/watch?v=Q8FRBGTJ020) + +## Articles + +* [Web API performance: profiling Django REST framework](http://dabapps.com/blog/api-performance-profiling-django-rest-framework/) +* [API Development with Django and Django REST Framework](https://bnotions.com/api-development-with-django-and-django-rest-framework/) From 1390b6801e45c38db474e77daefd867e7ea7f825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Sat, 13 Sep 2014 16:20:16 -0400 Subject: [PATCH 05/14] Include third party resources link in home page --- mkdocs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.py b/mkdocs.py index b4c414080..25cb55e21 100755 --- a/mkdocs.py +++ b/mkdocs.py @@ -76,6 +76,7 @@ path_list = [ 'topics/browser-enhancements.md', 'topics/browsable-api.md', 'topics/rest-hypermedia-hateoas.md', + 'topics/third-party-resources.md', 'topics/contributing.md', 'topics/rest-framework-2-announcement.md', 'topics/2.2-announcement.md', From 4871dbdc73632be4fb00befbc816bc670bb609cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Sat, 13 Sep 2014 16:20:37 -0400 Subject: [PATCH 06/14] Add invitation to add new content --- docs/topics/third-party-resources.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/third-party-resources.md b/docs/topics/third-party-resources.md index da92eb33a..2df13ef8a 100644 --- a/docs/topics/third-party-resources.md +++ b/docs/topics/third-party-resources.md @@ -4,6 +4,8 @@ Django REST Framework has a growing community of developers, packages, and resou Check out a grid detailing all the packages and ecosystem around Django REST Framework at [Django Packages](https://www.djangopackages.com/grids/g/django-rest-framework/). +To submit new content, [open an issue](https://github.com/tomchristie/django-rest-framework/issues/new) or [create a pull request](https://github.com/tomchristie/django-rest-framework/). Pull requests will be given higher priority since they are easier to include. + ## Libraries and Extensions ### Authentication From 915dfb9b3d6c235437a6459493cf26d248022e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Sun, 14 Sep 2014 10:19:54 -0400 Subject: [PATCH 07/14] Update third-party-resources.md --- docs/topics/third-party-resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/third-party-resources.md b/docs/topics/third-party-resources.md index 2df13ef8a..e337cbd54 100644 --- a/docs/topics/third-party-resources.md +++ b/docs/topics/third-party-resources.md @@ -4,7 +4,7 @@ Django REST Framework has a growing community of developers, packages, and resou Check out a grid detailing all the packages and ecosystem around Django REST Framework at [Django Packages](https://www.djangopackages.com/grids/g/django-rest-framework/). -To submit new content, [open an issue](https://github.com/tomchristie/django-rest-framework/issues/new) or [create a pull request](https://github.com/tomchristie/django-rest-framework/). Pull requests will be given higher priority since they are easier to include. +To submit new content, [open an issue](https://github.com/tomchristie/django-rest-framework/issues/new) or [create a pull request](https://github.com/tomchristie/django-rest-framework/). ## Libraries and Extensions From 3725a1e77dafef4c6bdb7847bace92ff61f7f4e5 Mon Sep 17 00:00:00 2001 From: "S. Andrew Sheppard" Date: Mon, 15 Sep 2014 14:46:09 -0500 Subject: [PATCH 08/14] add wq.db router and django-rest-pandas renderers --- docs/topics/third-party-resources.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/third-party-resources.md b/docs/topics/third-party-resources.md index e337cbd54..1ca917427 100644 --- a/docs/topics/third-party-resources.md +++ b/docs/topics/third-party-resources.md @@ -41,6 +41,7 @@ To submit new content, [open an issue](https://github.com/tomchristie/django-res ### Routers * [drf-nested-routers](https://github.com/alanjds/drf-nested-routers) - Provides routers and relationship fields for working with nested resources. +* [wq.db.rest](http://wq.io/docs/about-rest) - Provides an admin-style model registration API with reasonable default URLs and viewsets. ### Parsers @@ -51,6 +52,7 @@ To submit new content, [open an issue](https://github.com/tomchristie/django-res * [djangorestframework-csv](https://github.com/mjumbewu/django-rest-framework-csv) - Provides CSV renderer support. * [drf_ujson](https://github.com/gizmag/drf-ujson-renderer) - Implements JSON rendering using the UJSON package. +* [Django REST Pandas](https://github.com/wq/django-rest-pandas) - Pandas DataFrame-powered renderers including Excel, CSV, and SVG formats. ### Filtering From e5af0bbb353e772473b1d9fcfc896bfd7365db2a Mon Sep 17 00:00:00 2001 From: Matthew J Morrison Date: Wed, 17 Sep 2014 07:49:54 -0500 Subject: [PATCH 09/14] Clarify "raised inside REST framework" I ran into an issue today where I was not seeing the rest_framework.views.exception_handler do what I thought it should be doing. It turned out that I had imported View from rest_framework.views rather than importing APIView from rest_framework.views. The phrase "raised inside REST framework" was confusing as I was debugging this issue. I was unsure if that meant that I could raise those exceptions in my code or if it had to originate from within framework code. I'm not sure if the proposed wording is ideal, I just wanted to point out what I found to be confusing. --- docs/api-guide/exceptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/exceptions.md b/docs/api-guide/exceptions.md index 66e181737..33c4dc910 100644 --- a/docs/api-guide/exceptions.md +++ b/docs/api-guide/exceptions.md @@ -84,7 +84,7 @@ Note that the exception handler will only be called for responses generated by r **Signature:** `APIException()` -The **base class** for all exceptions raised inside REST framework. +The **base class** for all exceptions raised inside an APIView class or @api_view. To provide a custom exception, subclass `APIException` and set the `.status_code` and `.default_detail` properties on the class. From a37db382c69293953c709365cd2c64c4a99f419e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Wed, 17 Sep 2014 09:01:49 -0400 Subject: [PATCH 10/14] Update authtoken latest Django 1.7 migration --- rest_framework/authtoken/migrations/0001_initial.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rest_framework/authtoken/migrations/0001_initial.py b/rest_framework/authtoken/migrations/0001_initial.py index 2e5d6b47e..6ea761822 100644 --- a/rest_framework/authtoken/migrations/0001_initial.py +++ b/rest_framework/authtoken/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 + from __future__ import unicode_literals from django.db import models, migrations @@ -16,11 +16,10 @@ class Migration(migrations.Migration): name='Token', fields=[ ('key', models.CharField(max_length=40, serialize=False, primary_key=True)), - ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, to_field='id')), ('created', models.DateTimeField(auto_now_add=True)), + ('user', models.OneToOneField(related_name=b'auth_token', to=settings.AUTH_USER_MODEL)), ], options={ - 'abstract': False, }, bases=(models.Model,), ), From de5fbf7d63245e9d14844e66fdf16f88dbfae2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Wed, 17 Sep 2014 10:23:53 -0400 Subject: [PATCH 11/14] Update initial migration to work on Python 3 --- rest_framework/authtoken/migrations/0001_initial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest_framework/authtoken/migrations/0001_initial.py b/rest_framework/authtoken/migrations/0001_initial.py index 6ea761822..769f62029 100644 --- a/rest_framework/authtoken/migrations/0001_initial.py +++ b/rest_framework/authtoken/migrations/0001_initial.py @@ -1,4 +1,4 @@ - +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations @@ -15,9 +15,9 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Token', fields=[ - ('key', models.CharField(max_length=40, serialize=False, primary_key=True)), + ('key', models.CharField(primary_key=True, serialize=False, max_length=40)), ('created', models.DateTimeField(auto_now_add=True)), - ('user', models.OneToOneField(related_name=b'auth_token', to=settings.AUTH_USER_MODEL)), + ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, related_name='auth_token')), ], options={ }, From 8c8d355e761a67fffd334dc15bc7bb74238300bc Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 17 Sep 2014 15:51:17 +0100 Subject: [PATCH 12/14] Update routers.py --- rest_framework/routers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 01fd4b91a..f2d062118 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -295,6 +295,7 @@ class DefaultRouter(SimpleRouter): format=kwargs.get('format', None) ) except NoReverseMatch: + # Don't bail out if eg. no list routes exist, only detail routes. continue return Response(ret) From 764366b2e11ad9ad85dd34500e95721011cae7d4 Mon Sep 17 00:00:00 2001 From: Matthew J Morrison Date: Wed, 17 Sep 2014 11:29:15 -0500 Subject: [PATCH 13/14] Fixed code formatting --- docs/api-guide/exceptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/exceptions.md b/docs/api-guide/exceptions.md index 33c4dc910..e61dcfa90 100644 --- a/docs/api-guide/exceptions.md +++ b/docs/api-guide/exceptions.md @@ -84,7 +84,7 @@ Note that the exception handler will only be called for responses generated by r **Signature:** `APIException()` -The **base class** for all exceptions raised inside an APIView class or @api_view. +The **base class** for all exceptions raised inside an `APIView` class or `@api_view`. To provide a custom exception, subclass `APIException` and set the `.status_code` and `.default_detail` properties on the class. From 7f758d1cf694c9227a1f55df400ff81e4bce2956 Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Thu, 18 Sep 2014 10:30:13 -0600 Subject: [PATCH 14/14] Fix missing CSRF exemption on viewsets --- rest_framework/viewsets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/viewsets.py b/rest_framework/viewsets.py index bb5b304ee..84b4bd8dd 100644 --- a/rest_framework/viewsets.py +++ b/rest_framework/viewsets.py @@ -20,6 +20,7 @@ from __future__ import unicode_literals from functools import update_wrapper from django.utils.decorators import classonlymethod +from django.views.decorators.csrf import csrf_exempt from rest_framework import views, generics, mixins @@ -89,7 +90,7 @@ class ViewSetMixin(object): # resolved URL. view.cls = cls view.suffix = initkwargs.get('suffix', None) - return view + return csrf_exempt(view) def initialize_request(self, request, *args, **kargs): """