diff options
author | Stephen Finucane <stephen@that.guru> | 2016-11-24 12:55:42 +0000 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2016-12-23 23:41:29 +0000 |
commit | 3e8048fc1aef396301083d1141d82de55e423418 (patch) | |
tree | 736080c85b32d4c9d45b63d144b387bd1a5a335a /tox.ini | |
parent | dc787e93a771addddf0f6ceff5d853240d217f2b (diff) | |
download | patchwork-3e8048fc1aef396301083d1141d82de55e423418.tar patchwork-3e8048fc1aef396301083d1141d82de55e423418.tar.gz |
REST: Use generic views instead of ViewSets
ViewSet provide an easy way to define an API, but they don't offer much
flexibility. To get them to work as expected, a lot of hacks were
required. Generic views provide a more verbose, but ultimately easier to
understand, version. Using generic views lets us remove the dependency
of drf-nested-routers, bringing us back down to two main dependencies.
It also lets us remove the AuthenticatedReadOnly permission class, as
the DRF provides a similar permission class that can be used with
generic views.
The main user facing change is that invalid methods, such as POST on an
endpoint that doesn't allow object creation, will now return a HTTP 405
(Method Not Allowed) error code rather than the HTTP 403 (Forbidden)
error code previously returned. This is the semantically correct option
and should have been used all along.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Diffstat (limited to 'tox.ini')
-rw-r--r-- | tox.ini | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -14,7 +14,6 @@ deps = django19: django>=1.9,<1.10 django110: django>=1.10,<1.11 django{18,19,110}: djangorestframework>=3.5,<3.6 - drf-nested-routers>=0.11.1,<0.12 setenv = DJANGO_SETTINGS_MODULE = patchwork.settings.dev PYTHONDONTWRITEBYTECODE = 1 |