Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
5524339e
Commit
5524339e
authored
Jun 16, 2015
by
Xavier Ordoquy
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3037 from jpadilla/master
Fix versioning urls
parents
7f0acbd5
0be6d87f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
docs/api-guide/versioning.md
+3
-3
rest_framework/versioning.py
+2
-2
tests/test_versioning.py
+1
-1
No files found.
docs/api-guide/versioning.md
View file @
5524339e
...
...
@@ -3,7 +3,7 @@ source: versioning.py
# Versioning
> Versioning an interface is just a "polite" way to kill deployed clients.
>
>
> — [Roy Fielding][cite].
API versioning allows you to alter behavior between different clients. REST framework provides for a number of different versioning schemes.
...
...
@@ -117,12 +117,12 @@ Your URL conf must include a pattern that matches the version with a `'version'`
urlpatterns = [
url(
r'^(?P<version>
{v1,v2}
)/bookings/$',
r'^(?P<version>
[v1|v2]+
)/bookings/$',
bookings_list,
name='bookings-list'
),
url(
r'^(?P<version>
{v1,v2}
)/bookings/(?P<pk>[0-9]+)/$',
r'^(?P<version>
[v1|v2]+
)/bookings/(?P<pk>[0-9]+)/$',
bookings_detail,
name='bookings-detail'
)
...
...
rest_framework/versioning.py
View file @
5524339e
...
...
@@ -59,8 +59,8 @@ class URLPathVersioning(BaseVersioning):
An example URL conf for two views that accept two different versions.
urlpatterns = [
url(r'^(?P<version>
{v1,v2}
)/users/$', users_list, name='users-list'),
url(r'^(?P<version>
{v1,v2}
)/users/(?P<pk>[0-9]+)/$', users_detail, name='users-detail')
url(r'^(?P<version>
[v1|v2]+
)/users/$', users_list, name='users-list'),
url(r'^(?P<version>
[v1|v2]+
)/users/(?P<pk>[0-9]+)/$', users_detail, name='users-detail')
]
GET /1.0/something/ HTTP/1.1
...
...
tests/test_versioning.py
View file @
5524339e
...
...
@@ -128,7 +128,7 @@ class TestURLReversing(UsingURLPatterns, APITestCase):
urlpatterns
=
[
url
(
r'^v1/'
,
include
(
included
,
namespace
=
'v1'
)),
url
(
r'^another/$'
,
dummy_view
,
name
=
'another'
),
url
(
r'^(?P<version>[
^/
]+)/another/$'
,
dummy_view
,
name
=
'another'
),
url
(
r'^(?P<version>[
v1|v2
]+)/another/$'
,
dummy_view
,
name
=
'another'
),
]
def
test_reverse_unversioned
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment