i have a similar problem. when i installed the env and django it did not require me to create password but after successfully installing django and trying to open admin, i need password and i cannot enter so i am stuck. Can someone help me?
On Tuesday, July 12, 2011 at 7:31:27 AM UTC+1, Suprnaturall wrote:
Hi,
First of all, apologize me for my poor, poor english.
I m new with django and i m stuck with a odd thing.
I created a login form and use the default django login handlet like
this :
base.html :
(...) {% if user.is_authenticated %}
<a href="#">{{user.username }}</a>
{% else %}
<a href="{% url django.contrib.auth.views. login %}?
next={{request.path}}">Login</a>
{% endif %}
<a href="/accounts/logout/">log out</a
(...)
login.html :
{% extends "base.html" %}
{% block content %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
<form method="post" action='.'>
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value={{request.path}} />
</form>
{% endblock %}
The problem is : when i m in login.html i see my user.username, but
when i submit the login form and being redirect to index i don t
retrieve the user.username.
I add in my views.py this import :
from django.template import Context, loader, RequestContext
from empireFront.models import Video
from django.http import HttpResponse
from django.contrib import auth
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.contrib.sessions.models import Session
I heard something about use render_to_response but when, where and
how ?
Thx for your help !
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7f4f7a9f-cf9a-4bf1-9d63-d2b711a58f68%40googlegroups.com.
No comments:
Post a Comment