I was trying to create login in my application .As per what is given
in djangobook I created the login view as follows

def login_view(request):
        if request.method=='POST':
                print 'login_view()::POST'
                username=request.POST['username']
                password=request.POST['password']
                print 'login_view:from req got username=',username
                print 'login_view:from req got password=',password
                user = authenticate(username=username, password=password)
                if user is not None and user.is_active:
                        print 'login_view:login success'
                        login(request, user)
                        return redirect('myapp_entry_archive_index')
        else:
                print 'login_view:GET method'
                print 'login_view:login failed'
                return render_to_response('myapp/login.html')

I also created these urls,
projects url.py
------------
(r'^myapp/',include('myapp.urls.login')),

urls/login.py
-----------
urlpatterns=patterns('',
url(r'^','myapp.views.login_view',name='myapp_login'),

)
Also a login page
login.html
--------------
This is the login page
<form method="post" action="{%url myapp_login %}">
        <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" >

        <input type="submit" value="login" />
        <input type="hidden" name="next" value="{{next|escape}}" />

</form>


when I give a wrong username password combination ,I get this error
ValueError,.views.login_view didn't return an HttpResponse object.

Can someone help me correct this?

-- 
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.

Reply via email to