django-registration - stuck at Required templates topic

21 views
Skip to first unread message

bob gailer

unread,
Aug 4, 2011, 10:42:05 PM8/4/11
to Django users
I followed the installation & configuration of django-registration up
to the start of the Required templates topic. After that I am very
lost. "In the default setup, you will need to create several templates
required by django-registration...." I have little idea what to do or
where to do it.

Reading error messages led to the (apparantly successful) idea of
putting templates in D:\django\mysite\templates\registration. But now
what? I presume the form must have a submit button. To what URL would
it get submitted and what names does it use for the user-entered
fields?

Or am I totally misunderstanding something.

Any help appreciated.

Mario Gudelj

unread,
Aug 4, 2011, 11:47:32 PM8/4/11
to django...@googlegroups.com
Hey Bob,

You can download some basic templates for this page http://devdoodles.wordpress.com/2009/02/16/user-authentication-with-django-registration/

Cheers,




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


bob gailer

unread,
Aug 5, 2011, 12:12:26 AM8/5/11
to Django users


On Aug 4, 11:47 pm, Mario Gudelj <mario.gud...@gmail.com> wrote:
> Hey Bob,
>
> You can download some basic templates for this pagehttp://devdoodles.wordpress.com/2009/02/16/user-authentication-with-d...

OK - did that - now what? I can get the login form displayed - when I
click get:

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure:

CSRF token missing or incorrect.


In general, this can occur when there is a genuine Cross Site Request
Forgery, or when Django's CSRF mechanism has not been used correctly.
For POST forms, you need to ensure:

The view function uses RequestContext for the template, instead of
Context.
In the template, there is a {% csrf_token %} template tag inside
each POST form that targets an internal URL.
If you are not using CsrfViewMiddleware, then you must use
csrf_protect on any views that use the csrf_token template tag, as
well as those that accept the POST data.

I have no idea what to do with that message.

I need a lot more hand-holding, since I am VERY new to django.

Phang Mulianto

unread,
Aug 5, 2011, 12:52:58 AM8/5/11
to django...@googlegroups.com

well..like the error said..you need to put {% csrf_token %} inside your form.. do you read the tutorial? you should read it if you serious getting in django. . it helps you alot as it help me too..

Bruce Dou

unread,
Aug 5, 2011, 2:56:23 AM8/5/11
to django...@googlegroups.com
I also think that should be a default simple template in the package.
--
A decathlon Developer & programmer
http://blog.eood.cn/

bob gailer

unread,
Aug 6, 2011, 12:42:34 AM8/6/11
to Django users
I have stumbled around following various pieces of advice:

added to views:
from django.core.context_processors import csrf

modified views to end with:
form = ContactForm()
c = {}
c.update(csrf(request))
c['form'] = form
return render_to_response('contact_form.html', c)

modified contact_form.html:
<form action="" method="post">{% csrf_token %}

The first bullet in the error message:
The view function uses RequestContext for the template, instead of
Context.
makes no sense - even after attempting to read what the
RequestContext link points to.
|
now what?

Eyad Al-Sibai

unread,
Aug 6, 2011, 12:54:42 AM8/6/11
to django...@googlegroups.com
I had the same thing...

all what you need is to add " {% csrf_token %}" in each template for Post form

it will solve your issue

Reply all
Reply to author
Forward
0 new messages