My application and me will be eternally thankful for your help.
++COMMAND LINE
python manage.py shell
>>> from django.contrib.auth import authenticate
>>> user = authenticate(username='john', password='johnpassword')
++VIEWS.PY
from django.contrib.auth.models import User
def index(request):
return render_to_response('unoporuno/index.html', None, context_instance=RequestContext(request))
def login_cidesal(request):
usuario = request.POST['usuario']
clave = request.POST['clave']
user = authenticate(user=usuario, password=clave)
return HttpResponse("logging in user:" + usuario + " with password:" + clave + " and authenticate result=" + str(user))
++URLS.PY
urlpatterns = patterns('unoporuno.views',
url(r'^$','index'),
url(r'login/', 'login_cidesal'),
++INDEX.HTML
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}style1.css"/>
</head>
<body>
<form method="post" action="/unoporuno/login/">
{% csrf_token %}
<div align="center">
<img src="{{ STATIC_URL }}cidesal.jpg" height="140" width="140" border="0"/>
<h1>UnoporunO</h1>
<h4>Buscador de personas especializado en movilidad profesional</h4>
<br/>
Usuario: <input type="text" name="usuario" size="16" /><br/><br/>
Clave : <input type="password" name="clave" size="16" /><br/>
<p><input type="submit" value="Login" /></p>
</div>
</body>
</html>
++WEB RESULT TYPING usuario=john clave=johnpassword
logging in user:john with password:johnpassword and authenticate result=None