diff options
| author | Philip Douglas | 2013-09-10 13:09:25 +0100 |
|---|---|---|
| committer | Philip Douglas | 2013-09-10 13:09:25 +0100 |
| commit | 39e13a0d1341c0a0e694acb1522a99470c4037be (patch) | |
| tree | 27b498f3cbf81faa1ff587d0730e07706c7551a8 /rest_framework/routers.py | |
| parent | ef7ce344865938bea285a408a7cc415a7b90a83c (diff) | |
| parent | f5c34926d6a4b4b29fb083d25b99b10d7431eee4 (diff) | |
| download | django-rest-framework-39e13a0d1341c0a0e694acb1522a99470c4037be.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'rest_framework/routers.py')
| -rw-r--r-- | rest_framework/routers.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 930011d3..3fee1e49 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -189,7 +189,11 @@ class SimpleRouter(BaseRouter): Given a viewset, return the portion of URL regex that is used to match against a single instance. """ - base_regex = '(?P<{lookup_field}>[^/]+)' + if self.trailing_slash: + base_regex = '(?P<{lookup_field}>[^/]+)' + else: + # Don't consume `.json` style suffixes + base_regex = '(?P<{lookup_field}>[^/.]+)' lookup_field = getattr(viewset, 'lookup_field', 'pk') return base_regex.format(lookup_field=lookup_field) |
