def register_user(request): if request.method == 'POST': form = MyUserCreationForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/accounts/register_success') args = {} args.update(csrf(request)) args['form'] = MyUserCreationForm() return render_to_response('register.html', args)
def userRegister(request): if request.method == 'POST': form = MyUserCreationForm(data=request.POST) if form.is_valid(): form.save() return redirect('/usuarios/login') else: form = MyUserCreationForm() context = {'form' : form} return render(request, "usuarios/register.html", context)
def create_new_user(request): """ View to create a new user """ if request.method == 'POST': form = MyUserCreationForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect("/accounts/login/") else: return render_to_response("auth/create.html", {'form': form, }) else: form = MyUserCreationForm() return render_to_response("auth/create.html", {'form': form, }, RequestContext(request))
def signup(request): if request.method == 'POST': username = request.POST['username'] password = request.POST['password1'] form = MyUserCreationForm(request.POST) if form.is_valid(): form.save() user = authenticate(username=username, password=password) auth_login(request, user) messages.success(request, 'Profile successfully created.') return redirect(reverse('home')) else: form = MyUserCreationForm() return render(request, 'accounts/signup.html', {'form': form})
def register(request): if request.method == 'POST': form = MyUserCreationForm(request.POST) #pdb.set_trace() if form.is_valid(): form.save() return render( request, 'login.html', { 'message': 'You are successfully registered. Log in now, please.', 'request': request }) else: return render( request, 'register.html', { 'message': 'Please, enter the correct input!', 'request': request, 'form': form, })
def reg_user(request): if request.method == 'POST': form = MyUserCreationForm(request.POST) if form.is_valid(): username = form.clean_username() form.save() # Edit zone file change_zone_file(FILEPATH, username) # call function to change dns zones file return HttpResponseRedirect("/regsuccess/") else: form = MyUserCreationForm() return render_to_response("registration.html", {"form":form}, context_instance=RequestContext(request))
def register(request): if request.method == 'POST': form = MyUserCreationForm(request.POST) if form.is_valid(): new_user = form.save() return HttpResponseRedirect("/accounts/login/") else: form = MyUserCreationForm() return render_to_response("accounts/register.html", { 'form': form, }, context_instance=RequestContext(request))
def create_new_user(request): """ View to create a new user """ if request.method == 'POST': form = MyUserCreationForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect("/accounts/login/") else: return render_to_response("auth/create.html", { 'form': form, }) else: form = MyUserCreationForm() return render_to_response("auth/create.html", { 'form': form, }, RequestContext(request))