diff options
| author | Tom Christie | 2014-09-26 14:39:20 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-26 14:39:20 +0100 |
| commit | ac71d9aaae27f620fdb0167a4ad586e754a844a3 (patch) | |
| tree | 15c19362b95cc72f104f1d41a6799399ba97d36f /docs/api-guide | |
| parent | 609014460861fdfe82054551790d6439292dde7b (diff) | |
| parent | 411511622d163ad81720651869b80dc9de526d65 (diff) | |
| download | django-rest-framework-ac71d9aaae27f620fdb0167a4ad586e754a844a3.tar.bz2 | |
Merge master
Diffstat (limited to 'docs/api-guide')
| -rwxr-xr-x | docs/api-guide/authentication.md | 7 | ||||
| -rw-r--r-- | docs/api-guide/format-suffixes.md | 13 |
2 files changed, 11 insertions, 9 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 343466ee..0ec5bad1 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -190,9 +190,10 @@ If you've already created some users, you can generate tokens for all existing u When using `TokenAuthentication`, you may want to provide a mechanism for clients to obtain a token given the username and password. REST framework provides a built-in view to provide this behavior. To use it, add the `obtain_auth_token` view to your URLconf: - urlpatterns += patterns('', - url(r'^api-token-auth/', 'rest_framework.authtoken.views.obtain_auth_token') - ) + from rest_framework.authtoken import views + urlpatterns += [ + url(r'^api-token-auth/', views.obtain_auth_token) + ] Note that the URL part of the pattern can be whatever you want to use. diff --git a/docs/api-guide/format-suffixes.md b/docs/api-guide/format-suffixes.md index 529738e3..76a3367b 100644 --- a/docs/api-guide/format-suffixes.md +++ b/docs/api-guide/format-suffixes.md @@ -26,12 +26,13 @@ Arguments: Example: from rest_framework.urlpatterns import format_suffix_patterns - - urlpatterns = patterns('blog.views', - url(r'^/$', 'api_root'), - url(r'^comments/$', 'comment_list'), - url(r'^comments/(?P<pk>[0-9]+)/$', 'comment_detail') - ) + from blog import views + + urlpatterns = [ + url(r'^/$', views.apt_root), + url(r'^comments/$', views.comment_list), + url(r'^comments/(?P<pk>[0-9]+)/$', views.comment_detail) + ] urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'html']) |
