def create(request): if request.POST: form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() messages.success(request, _("User '{0}' created.").format(user)) return redirect('wagtailusers_index') else: messages.error(request, _("The user could not be created due to errors.") ) else: form = UserCreationForm() return render(request, 'wagtailusers/create.html', { 'form': form, })
def create(request): if request.POST: form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() messages.success(request, _("User '{0}' created.").format(user), buttons=[ messages.button(reverse('wagtailusers_users:edit', args=(user.id,)), _('Edit')) ]) return redirect('wagtailusers_users:index') else: messages.error(request, _("The user could not be created due to errors.")) else: form = UserCreationForm() return render(request, 'wagtailusers/users/create.html', { 'form': form, })
def create(request): if request.POST: form = UserCreationForm(request.POST) if form.is_valid(): user = form.save() messages.success(request, "User '%s' created." % user) return redirect('wagtailusers_index') else: messages.error(request, "The user could not be created due to errors.") else: form = UserCreationForm() return render(request, 'wagtailusers/create.html', { 'form': form, })