In my base.html
I placed this:
{% if user.is_authenticated %}
you are logged in!
{% else %}
<h3>Login</h3>
<form action="/login/" method="post" accept-charset="utf-8">
<label for="username">Username</label><input type="text" name="username" value="" id="username" />
<label for="password">Password</label><input type="password" name="password" value="" id="password" />
<p><input type="submit" value="Login →"></p>
</form>
{% endif %}
In urls.py
:
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^logout/$', 'django.contrib.auth.views.logout'),
When I accessed /login
I had to make a login.html
file. I created templates/registration/login.html
:
{% extends "base.html" %}
{% block content %}
{% if form.errors %}
<p>Your username/pass didnt match</p>
{% endif %}
{% endblock %}
I'm not seeing the username/pass, but I'm still seeing the meaning my user is not authenticated yet.
Btw, I don't have the CSRF middleware loaded. Did I miss a step or two?
One other thing, I accessed logout.html
and it went into my django admin logout page. I tried making a templates/registration/logout.html
but it didn't override that part. Hrm?