2012-11-11 04:09:14 +04:00
|
|
|
"""
|
|
|
|
Login and logout views for token authentication.
|
|
|
|
|
|
|
|
Add these to your root URLconf if you're using token authentication
|
|
|
|
your API requires authentication.
|
|
|
|
|
|
|
|
The urls must be namespaced as 'rest_framework', and you should make sure
|
|
|
|
your authentication settings include `TokenAuthentication`.
|
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
|
|
...
|
|
|
|
url(r'^auth-token', include('rest_framework.authtoken.urls', namespace='rest_framework'))
|
|
|
|
)
|
|
|
|
"""
|
|
|
|
from django.conf.urls.defaults import patterns, url
|
2012-11-13 03:16:53 +04:00
|
|
|
from rest_framework.authtoken.views import AuthTokenView
|
2012-11-11 04:09:14 +04:00
|
|
|
|
|
|
|
urlpatterns = patterns('rest_framework.authtoken.views',
|
2012-11-13 03:16:53 +04:00
|
|
|
url(r'^login/$', AuthTokenView.as_view(), name='token_login'),
|
2012-11-11 04:09:14 +04:00
|
|
|
)
|