Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » visual quickpro chapter 10 - csrf token [RSS Feed]

#1 Dec. 22, 2010 15:44:59

S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

visual quickpro chapter 10 - csrf token


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 django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » visual quickpro chapter 10 - csrf token [RSS Feed]

Board footer

Moderator control

Enjoy the 13th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support