2012-09-04 15:02:05 +04:00
|
|
|
"""
|
|
|
|
Login and logout views for the browseable API.
|
|
|
|
|
|
|
|
Add these to your root URLconf if you're using the browseable API and
|
|
|
|
your API requires authentication.
|
|
|
|
|
|
|
|
The urls must be namespaced as 'djangorestframework', and you should make sure
|
|
|
|
your authentication settings include `SessionAuthentication`.
|
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
|
|
...
|
|
|
|
url(r'^auth', include('djangorestframework.urls', namespace='djangorestframework'))
|
|
|
|
)
|
|
|
|
"""
|
2012-02-25 22:45:17 +04:00
|
|
|
from django.conf.urls.defaults import patterns, url
|
2011-05-04 12:21:17 +04:00
|
|
|
|
2012-02-25 22:45:17 +04:00
|
|
|
|
|
|
|
template_name = {'template_name': 'djangorestframework/login.html'}
|
|
|
|
|
|
|
|
urlpatterns = patterns('django.contrib.auth.views',
|
|
|
|
url(r'^login/$', 'login', template_name, name='login'),
|
|
|
|
url(r'^logout/$', 'logout', template_name, name='logout'),
|
2011-05-04 12:21:17 +04:00
|
|
|
)
|