def create_data(request): #u_form = User.AdminForm user_form = User.AdminForm(request.POST) if user_form.is_valid(): user = User() user.create_user(user_form.cleaned_data['username'], user_form.cleaned_data['password'], user_form.cleaned_data['email']) #user = User(username=user_form.cleaned_data['username']) #user.is_superuser = True #user.is_staff = True #user.save() #s_form = GeneralSettings.AdminForm settings_form = GeneralSettings.AdminForm(request.POST) if settings_form.is_valid(): settings = GeneralSettings(**settings_form.cleaned_data) settings.save() create_menu() return HttpResponseRedirect(reverse('dashboard'))
def save(self): new_user = User.create_user(self.cleaned_data['username'], self.cleaned_data['password1'], self.cleaned_data['email']) return new_user