Yeah, I've done that, but its not working! Any help? On Jan 17, 10:37 pm, Mark Furbee <[email protected]> wrote: > It means, don't use the "decorator" @login_required above your login view. > Your login view cannot require a login, because you'd never get to log in. > Chicken and egg. > > > > On Tue, Jan 17, 2012 at 2:34 PM, coded kid <[email protected]> wrote: > > > Thorsten Sanders wrote: > > > With using > > > > @login_required decorator the user needs to be logged in to allow > > execution, don't makes much sense for a login :P > > > > Am 17.01.2012 22:23, schrieb coded kid: > > > > Hi guys, I�m having problem with my login form. The login form will > > > > redirect me to the next page even if I didn�t input anything in the > > > > username and password field. Also it can�t get the username of the > > > > registered users to verify if the user data is wrong or right. How can > > > > I get rid of this problem? > > > > Below are my code: > > > > In views.py > > > > from django.db import models > > > > from mymeek.meekme.models import RegisterForm > > > > from django.shortcuts import render_to_response > > > > from django.http import HttpResponse > > > > from django.template import RequestContext > > > > from django.http import HttpResponseRedirect > > > > from django.contrib.auth import authenticate, login > > > > from django.contrib.auth.decorators import login_required > > > > > @login_required > > > > def mylogin(request): > > > > if request.method=='POST': > > > > username= request.POST['username'] > > > > password= request.POST['password'] > > > > user=authenticate (username=username, password=password) > > > > if user is not None: > > > > if user.is_active: > > > > login(request, user) > > > > return HttpResponseRedirect('/logpage/') > > > > else: > > > > return direct_to_template(request,'q_error.html') > > > > else: > > > > return render_to_response('mainpage.html') > > > > In my template: > > > > <html> > > > > <form action='' method="post"> > > > > <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" /> > > > > </form> > > > > </html> > > > > Please help me out! Thanks. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

