Skip to content

Commit

Permalink
Acessa campos da requisição
Browse files Browse the repository at this point in the history
  • Loading branch information
brnocesar committed Jan 20, 2021
1 parent 13d0c6a commit c5b1601
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 4 additions & 3 deletions apps/templates/usuarios/cadastro.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ <h2>Criar conta</h2>
<div class="row">
<div class="col-12">
<div class="contact-form-area">
<form action="" method="">
<form action="{% url 'cadastro' %}" method="POST">
{% csrf_token %}
<div class="row">
<div class="col-12 col-lg-12">
<label for="nome_receita"><b>Nome completo</b></label>
Expand All @@ -37,8 +38,8 @@ <h2>Criar conta</h2>
<input type="password" class="form-control" name="password" placeholder="Digite sua senha" required>
</div>
<div class="col-12 col-lg-6">
<label for="password2"><b>Confirmação de senha</b></label>
<input type="password" class="form-control" name="password2" placeholder="Digite sua senha mais uma vez" required>
<label for="password_confirmation"><b>Confirmação de senha</b></label>
<input type="password" class="form-control" name="password_confirmation" placeholder="Digite sua senha mais uma vez" required>
</div>
<div class="col-12 text-center mt-4">
<button class="btn btn-success" type="submit">Criar sua conta</button>
Expand Down
11 changes: 10 additions & 1 deletion apps/usuarios/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.shortcuts import render
from django.shortcuts import render, redirect

def login(request):
return render(request, 'usuarios/login.html')
Expand All @@ -7,6 +7,15 @@ def logout(request):
pass

def cadastro(request):
if request.method == 'POST':
nome = request.POST['nome']
email = request.POST['email']
password = request.POST['password']
password_confirmation = request.POST['password_confirmation']
print(nome, email, password, password_confirmation)
print(request.POST)
return redirect('login')

return render(request, 'usuarios/cadastro.html')

def dashboard(request):
Expand Down

0 comments on commit c5b1601

Please sign in to comment.