The tables are made already in Admin Django, you only have to build template (html), and the view. For example, in views.py:
def login_ini(request):
variable1 = 'Pantalla de Acceso al Sistema'
error_log = 'ok'
username = request.POST.get('username')
password = request.POST.get('password') # valor del template
user = auth.authenticate(username=username, password=password)
if request.method == "POST":
if user is not None and user.is_active:
#Correct password, and the user is marked "active"
auth.login(request, user)
request.session['username_x'] = username # variable gobal
request.session['id_x'] =
user.id # variable gobal
return HttpResponseRedirect("principal")
error_log = "error"
context = {'user':user,"variable1":variable1,"error_log":error_log,}
return render(request,'login_ini.html',context)
def log_out(request):
logout(request)
return redirect('login_ini')
Where login_ini.html, is the authentication template.