firstboot: Rename views/urls to be non-numeric

This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2016-12-04 15:24:36 -05:00
1 parent c37aa0fbd5
commit 56686b7148
13 files changed
+40 -37

No files matched your search

+2 -2
View File
@@ -245,8 +245,8 @@ class UserChangePasswordForm(SetPasswordForm):
return user
class State1Form(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm):
"""Firstboot state 1: create a new user."""
class FirstBootForm(ValidNewUsernameCheckMixin, auth.forms.UserCreationForm):
"""User module first boot step: create a new admin user."""
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request')
+2 -1
View File
@@ -41,5 +41,6 @@ urlpatterns = [
{'template_name': 'login.html'}, name='login'),
url(r'^accounts/logout/$', auth_views.logout,
{'next_page': reverse_lazy('index')}, name='logout'),
url(r'^users/firstboot/$', public(views.State1View.as_view()), name='firstboot'),
url(r'^users/firstboot/$', public(views.FirstBootView.as_view()),
name='firstboot'),
]
+6 -6
View File
@@ -26,7 +26,7 @@ import django.views.generic
from django.utils.translation import ugettext as _, ugettext_lazy
from .forms import CreateUserForm, UserChangePasswordForm, UserUpdateForm, \
State1Form
FirstBootForm
from plinth import actions
from plinth import cfg
from plinth.errors import ActionError
@@ -168,10 +168,10 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
return super(UserChangePassword, self).form_valid(form)
class State1View(django.views.generic.CreateView):
class FirstBootView(django.views.generic.CreateView):
"""Create user account and log the user in."""
template_name = 'firstboot_state1.html'
form_class = State1Form
template_name = 'users_firstboot.html'
form_class = FirstBootForm
success_url = ''
def __init__(self, *args, **kwargs):
@@ -181,10 +181,10 @@ class State1View(django.views.generic.CreateView):
mark_step_done('users_firstboot')
self.success_url = next_step()
return super(State1View, self).__init__(*args, **kwargs)
return super(FirstBootView, self).__init__(*args, **kwargs)
def get_form_kwargs(self):
"""Make request available to the form (to insert messages)"""
kwargs = super(State1View, self).get_form_kwargs()
kwargs = super(FirstBootView, self).get_form_kwargs()
kwargs['request'] = self.request
return kwargs