diff options
| author | Paul Melnikow | 2014-01-04 16:57:50 -0500 |
|---|---|---|
| committer | Paul Melnikow | 2014-01-04 16:57:50 -0500 |
| commit | 3cd15fb1713dfc49e1bf1fd48045ca3ae5654e18 (patch) | |
| tree | 850fde84f1b288fcbf440f88f693a3eb7a1f9b80 /rest_framework/routers.py | |
| parent | a1d7aa8f712b659f9d8302a2d2a098d2538e6c89 (diff) | |
| download | django-rest-framework-3cd15fb1713dfc49e1bf1fd48045ca3ae5654e18.tar.bz2 | |
Router: Do not automatically adjust lookup_regex when trailing_slash is True
BREAKING CHANGE
When trailing_slash is set to True, the router no longer will adjust the lookup regex to allow it to include periods. To simulate the old behavior, the programmer should specify `lookup_regex = '[^/]+'` on the viewset.
https://github.com/tomchristie/django-rest-framework/pull/1328#issuecomment-31517099
Diffstat (limited to 'rest_framework/routers.py')
| -rw-r--r-- | rest_framework/routers.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 8766ecb2..df1233fd 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -224,11 +224,8 @@ class SimpleRouter(BaseRouter): try: lookup_value = viewset.lookup_value_regex except AttributeError: - if self.trailing_slash: - lookup_value = '[^/]+' - else: - # Don't consume `.json` style suffixes - lookup_value = '[^/.]+' + # Don't consume `.json` style suffixes + lookup_value = '[^/.]+' return base_regex.format( lookup_prefix=lookup_prefix, lookup_field=lookup_field, |
