0
At the moment I need to log in django.admin
and login that I myself have created in a models.py | Class Pessoa
. In this way it is not functional, because the admin
needs to be logged in for a normal user to log on the main screen(Dashboard).
At the moment my Login is done this way:
def login(request):
form = PessoaForm(request.POST, None)
if form.is_valid():
return redirect('dashboard')
return render(request, 'login.html', {'form': form})
I haven’t figured out a way to log out yet. I’m trying to develop a raw login, for example:
def login(request):
i = 0
counter = 10
exitloop = False
form = PessoaForm(request.POST, None)
user = Pessoa.cnpj
pwd = Pessoa.senha
while i < counter or exitloop == 1:
if user == Pessoa.cnpj and pwd == Pessoa.senha:
exitloop = 1
return redirect('dashboard')
i = i+1
return render(request, 'login.html', {'form': form})
But I still don’t think it’s the best way. Note: I need you to have a filter @login_required
but with this custom login and a way to log out.
I appreciate any direction or help for both coding and syntax.