I find a code, but the Django version is 0.9, I am using 1.4 and I am
a new learner, I want to run below code but report CSRF verification
failed.

from django.http import HttpResponse

text = """<form method="post" action="/add/">
    <input type="text" name="a" value="%d"> + <input type="text"
name="b" value="%d">
    <input type="submit" value="="> <input type="text" value="%d">
</form>"""

def index(request):
    if request.POST.has_key('a'):
        a = int(request.POST['a'])
        b = int(request.POST['b'])
    else:
        a = 0
        b = 0
    return HttpResponse(text % (a, b, a + b))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to