diff options
author | Stephen Finucane <stephen@that.guru> | 2017-04-27 00:58:03 +0100 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2017-04-28 23:52:04 +0100 |
commit | 5094cfdbf0b11af44f979b16e43e8cce36378322 (patch) | |
tree | 9b95ee6b274c991ea21371fd4c842b1e22ffc4f7 /patchwork/settings | |
parent | f75be7ed94ab98769b1c1fbcdef80a1c643724d5 (diff) | |
download | patchwork-5094cfdbf0b11af44f979b16e43e8cce36378322.tar patchwork-5094cfdbf0b11af44f979b16e43e8cce36378322.tar.gz |
REST: Fix versioning
One of the few remaining warts in the API is versioning. There is some
basic versioning there, but it doesn't work properly as-is. Fix this by
correcting the index endpoint ('/') to use Django REST Framework's
'reverse' function [1], which handles versioning for us [2] and
switching from 'NamespaceVersioning' to 'URLPathVersioning', the latter
of which does the same thing but in a different way.
[1] http://www.django-rest-framework.org/api-guide/reverse/#reverse
[2] http://www.django-rest-framework.org/api-guide/versioning/#reversing-urls-for-versioned-apis
[3] http://www.django-rest-framework.org/api-guide/versioning/#urlpathversioning
Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'patchwork/settings')
-rw-r--r-- | patchwork/settings/base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 5d5caf1..e6d34ba 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -144,7 +144,7 @@ except ImportError: REST_FRAMEWORK = { 'DEFAULT_VERSIONING_CLASS': - 'rest_framework.versioning.NamespaceVersioning', + 'rest_framework.versioning.URLPathVersioning', 'DEFAULT_PAGINATION_CLASS': 'patchwork.api.base.LinkHeaderPagination', 'DEFAULT_FILTER_BACKENDS': ( 'patchwork.compat.DjangoFilterBackend', |