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/urls.py | |
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/urls.py')
-rw-r--r-- | patchwork/urls.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/patchwork/urls.py b/patchwork/urls.py index e888386..8c8c172 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -232,7 +232,7 @@ if settings.ENABLE_REST_API: ] urlpatterns += [ - url(r'^api/1.0/', include(api_patterns)), + url(r'^api/(?P<version>(1.0))/', include(api_patterns)), ] |