38 lines
1.2 KiB
Python
Raw Normal View History

2013-12-15 17:09:22 +01:00
"""
top-level url dispatching
"""
from django.conf import settings
2017-05-27 00:55:55 +02:00
from django.conf.urls import include, url
2013-09-28 11:39:57 +02:00
from django.contrib import admin
from django.contrib.auth import views as auth_views
2017-05-27 00:55:55 +02:00
from django.conf.urls.static import static
def remember_me_login(request, *args, **kw):
"""
Wraps the default login view function. If user does not want to be
remembered, we change the cookie to a session cookie that gets cleared
when the browser is closed.
"""
if request.method == 'POST':
if request.POST.get('remember_me'):
request.session.set_expiry(settings.SESSION_COOKIE_AGE)
return auth_views.login(request, *args, **kw)
2017-05-27 00:55:55 +02:00
urlpatterns = [
2016-12-27 23:11:50 +01:00
url('', include('social_django.urls', namespace='social')),
url(r'^accounts/', include('nsupdate.login.urls')),
# registration and user settings
url(r'^account/', include('nsupdate.accounts.urls')),
2013-09-28 11:39:57 +02:00
url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^', include('nsupdate.main.urls')),
2017-05-27 00:55:55 +02:00
]
2013-09-28 11:39:57 +02:00
if settings.DEBUG:
2017-05-27 00:55:55 +02:00
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
import debug_toolbar
2017-05-27 00:55:55 +02:00
urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)