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
2911cd64
Commit
2911cd64
authored
Jan 13, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tweaks to 'lookup_value_regex' work
parent
4ab97843
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
docs/topics/2.4-accouncement.md
+1
-0
rest_framework/routers.py
+3
-5
No files found.
docs/topics/2.4-accouncement.md
View file @
2911cd64
...
...
@@ -2,3 +2,4 @@
*
List/detail routes.
*
1.3 Support dropped, install six for <=1.4.?.
*
`allow_none`
for char fields
*
`trailing_slash = True`
-->
`[^/]`
,
`trailing_slash = False`
-->
`[^/.]`
, becomes simply
`[^/]`
and
`lookup_value_regex`
is added.
rest_framework/routers.py
View file @
2911cd64
...
...
@@ -220,12 +220,10 @@ class SimpleRouter(BaseRouter):
https://github.com/alanjds/drf-nested-routers
"""
base_regex
=
'(?P<{lookup_prefix}{lookup_field}>{lookup_value})'
# Use `pk` as default field, unset set. Default regex should not
# consume `.json` style suffixes and should break at '/' boundaries.
lookup_field
=
getattr
(
viewset
,
'lookup_field'
,
'pk'
)
try
:
lookup_value
=
viewset
.
lookup_value_regex
except
AttributeError
:
# Don't consume `.json` style suffixes
lookup_value
=
'[^/.]+'
lookup_value
=
getattr
(
viewset
,
'lookup_value_regex'
,
'[^/.]+'
)
return
base_regex
.
format
(
lookup_prefix
=
lookup_prefix
,
lookup_field
=
lookup_field
,
...
...
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