2013-09-28 10:44:29 +02:00
|
|
|
from django.conf.urls import patterns, include, url
|
2013-09-28 11:39:57 +02:00
|
|
|
from django.contrib import admin
|
2013-11-15 10:07:40 +01:00
|
|
|
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
|
|
|
|
from django.contrib.auth import views as auth_views
|
2013-10-03 19:26:39 +02:00
|
|
|
|
2013-09-28 11:39:57 +02:00
|
|
|
admin.autodiscover()
|
2013-09-28 10:44:29 +02:00
|
|
|
|
2013-11-15 10:07:40 +01:00
|
|
|
from registration.backends.default.views import RegistrationView
|
|
|
|
from registration.forms import RegistrationForm
|
|
|
|
|
|
|
|
|
|
|
|
class Html5RegistrationForm(RegistrationForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Html5RegistrationForm, self).__init__(*args, **kwargs)
|
|
|
|
self.fields['username'].widget.attrs.update(dict(autofocus=None))
|
|
|
|
|
|
|
|
|
|
|
|
class Html5AuthenticationForm(AuthenticationForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Html5AuthenticationForm, self).__init__(*args, **kwargs)
|
|
|
|
self.fields['username'].widget.attrs.update(dict(autofocus=None))
|
|
|
|
|
|
|
|
|
|
|
|
class Html5PasswordChangeForm(PasswordChangeForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Html5PasswordChangeForm, self).__init__(*args, **kwargs)
|
|
|
|
self.fields['old_password'].widget.attrs.update(dict(autofocus=None))
|
|
|
|
|
|
|
|
|
2013-09-29 01:21:44 +02:00
|
|
|
urlpatterns = patterns(
|
|
|
|
'',
|
2013-11-02 05:15:06 +01:00
|
|
|
url('', include('social.apps.django_app.urls', namespace='social')),
|
2013-11-15 10:07:40 +01:00
|
|
|
# registration start
|
2013-11-16 04:12:44 +01:00
|
|
|
# these are some modified patterns from registration.backends.default.urls:
|
2013-11-15 10:07:40 +01:00
|
|
|
url(r'^accounts/register/$',
|
|
|
|
RegistrationView.as_view(form_class=Html5RegistrationForm),
|
|
|
|
name='registration_register'),
|
|
|
|
# from registration.auth_urls:
|
|
|
|
url(r'^accounts/login/$',
|
2013-11-16 04:12:44 +01:00
|
|
|
auth_views.login,
|
|
|
|
{'authentication_form': Html5AuthenticationForm,
|
|
|
|
'template_name': 'registration/login.html'},
|
2013-11-15 10:07:40 +01:00
|
|
|
name='auth_login'),
|
|
|
|
url(r'^accounts/password/change/$',
|
2013-11-16 04:12:44 +01:00
|
|
|
auth_views.password_change,
|
|
|
|
{'password_change_form': Html5PasswordChangeForm,
|
|
|
|
'template_name': 'registration/password_change.html', # own template
|
|
|
|
'post_change_redirect': '/account/profile'}, # reverse() does not work here
|
2013-11-15 10:07:40 +01:00
|
|
|
name='auth_password_change'),
|
2013-11-16 04:12:44 +01:00
|
|
|
url(r'^accounts/', include('registration.backends.default.urls')),
|
2013-11-15 10:07:40 +01:00
|
|
|
# registration end
|
2013-10-17 20:50:44 +00:00
|
|
|
url(r'^account/', include('nsupdate.accounts.urls')),
|
2013-09-28 11:39:57 +02:00
|
|
|
url(r'^admin/', include(admin.site.urls)),
|
2013-10-17 20:50:44 +00:00
|
|
|
url(r'^', include('nsupdate.main.urls')),
|
2013-09-28 11:39:57 +02:00
|
|
|
)
|
2013-09-28 10:44:29 +02:00
|
|
|
|
2013-09-28 11:39:57 +02:00
|
|
|
from django.conf import settings
|
2013-09-28 10:44:29 +02:00
|
|
|
|
2013-09-28 11:39:57 +02:00
|
|
|
if settings.DEBUG:
|
|
|
|
urlpatterns += patterns('django.contrib.staticfiles.views',
|
2013-09-29 01:21:44 +02:00
|
|
|
url(r'^static/(?P<path>.*)$', 'serve'), )
|