Hi i'm a new but enthusiast django user. After succesfully running the
django project tutorials and expirimenting a bit I bought two books
(visual quick pro and django tdg) ran by the first 9 chapters easily
but bumped into a problem with chapter 10 which simulates a login/
logout page.. After some investigation I understood that the book
didn't cover the integration of middleware class csrf.CsrfView.
Commenting out this class worked, but I got the point it is there for
a reason, so I tried to adopt csrfView by adding {% csrf_token %} to
my login.html template
This worked. However trying to logout I get this message:
TypeError at /logout/
'str' object is not callable
I suppose I should fix my logout view this is what I have:
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.template import RequestContext
from django.shortcuts import render_to_response
# Create your views here.
def main_page(request):
return render_to_response('main_page.html', RequestContext(request))
def logout_page(request):
logout(request)
return HttpResponseRedirect('/')
Please advise, regards
Django newbie.
--
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.