diff --git a/password_policies/tests/urls.py b/password_policies/tests/urls.py index c0ac3d2..cab9163 100644 --- a/password_policies/tests/urls.py +++ b/password_policies/tests/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import include, patterns, url +from django.conf.urls import include, url from password_policies.tests.views import TestHomeView -urlpatterns = patterns('', - url(r'^password/', include('password_policies.urls')), - url(r'^$', TestHomeView.as_view(), name='home'), - ) +urlpatterns = [ + url(r'^password/', include('password_policies.urls')), + url(r'^$', TestHomeView.as_view(), name='home'), +] diff --git a/password_policies/urls.py b/password_policies/urls.py index a2e5c50..9bef2b9 100644 --- a/password_policies/urls.py +++ b/password_policies/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from password_policies.views import PasswordChangeFormView from password_policies.views import PasswordChangeDoneView @@ -8,23 +8,23 @@ from password_policies.views import PasswordResetDoneView -urlpatterns = patterns('', - url(r'^change/done/$', - PasswordChangeDoneView.as_view(), - name="password_change_done"), - url(r'^change/$', - PasswordChangeFormView.as_view(), - name="password_change"), - url(r'^reset/$', - PasswordResetFormView.as_view(), - name="password_reset"), - url(r'^reset/complete/$', - PasswordResetCompleteView.as_view(), - name="password_reset_complete"), - url(r'^reset/confirm/([0-9A-Za-z_\-]+)/([0-9A-Za-z]{1,13})/([0-9A-Za-z-=_]{1,32})/$', - PasswordResetConfirmView.as_view(), - name="password_reset_confirm"), - url(r'^reset/done/$', - PasswordResetDoneView.as_view(), - name="password_reset_done"), - ) +urlpatterns = [ + url(r'^change/done/$', + PasswordChangeDoneView.as_view(), + name="password_change_done"), + url(r'^change/$', + PasswordChangeFormView.as_view(), + name="password_change"), + url(r'^reset/$', + PasswordResetFormView.as_view(), + name="password_reset"), + url(r'^reset/complete/$', + PasswordResetCompleteView.as_view(), + name="password_reset_complete"), + url(r'^reset/confirm/([0-9A-Za-z_\-]+)/([0-9A-Za-z]{1,13})/([0-9A-Za-z-=_]{1,32})/$', + PasswordResetConfirmView.as_view(), + name="password_reset_confirm"), + url(r'^reset/done/$', + PasswordResetDoneView.as_view(), + name="password_reset_done"), +] diff --git a/password_policies/views.py b/password_policies/views.py index 8fb297e..db43146 100644 --- a/password_policies/views.py +++ b/password_policies/views.py @@ -78,7 +78,9 @@ def form_valid(self, form): form.save() return super(PasswordChangeFormView, self).form_valid(form) - def get_form(self, form_class): + def get_form(self, form_class=None): + if form_class is None: + form_class = self.get_form_class() return form_class(self.request.user, **self.get_form_kwargs()) def get_success_url(self): @@ -184,7 +186,9 @@ def get_context_data(self, **kwargs): kwargs['validlink'] = self.validlink return super(PasswordResetConfirmView, self).get_context_data(**kwargs) - def get_form(self, form_class): + def get_form(self, form_class=None): + if form_class is None: + form_class = self.get_form_class() return form_class(self.user, **self.get_form_kwargs()) def get_success_url(self):