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 /docs/api-guide/routers.md | |
| 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 'docs/api-guide/routers.md')
| -rw-r--r-- | docs/api-guide/routers.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index f3beabdd..6b4ae6db 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -83,7 +83,7 @@ This behavior can be modified by setting the `trailing_slash` argument to `False Trailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails. Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style. -With `trailing_slash` set to True, the router will match lookup values containing any characters except slashes and dots. When set to False, dots are allowed. To restrict the lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs: +The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs: class MyModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): lookup_field = 'my_model_id' |
