Re: CSRF token not adding hidden form field

2012-07-19 Thread fooues
Thanks .. I had the same problems and it worked too. On Saturday, June 12, 2010 4:54:34 AM UTC-3, Joel Klabo wrote: > > I finally got it to work by adding the RequestContext to my > render_to_response. I think the issue was that it was redirecting and > the csrf_token wasn't getting sent to the

Re: CSRF token not adding hidden form field

2010-06-12 Thread Joel Klabo
I finally got it to work by adding the RequestContext to my render_to_response. I think the issue was that it was redirecting and the csrf_token wasn't getting sent to the new page by the requestcontext, here is what it looks like now: (csrf_token is also in the form) return render_to_response('pr

Re: CSRF token not adding hidden form field

2010-06-11 Thread Ali Kusnadi
On 6/11/10, Joel Klabo wrote: > yeah, still 403. CSRF token missing or incorrect. > try add the 'django.core.context_processors.csrf' in your settings.py TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.csrf', ) > > -- > You received this message because you are sub

Re: CSRF token not adding hidden form field

2010-06-11 Thread shacker
On Jun 10, 8:41 pm, Joel Klabo wrote: > yeah, still 403. CSRF token missing or incorrect. Not to state the obvious, but are you positive you're working with the right set of templates? I only ask because this happened to me recently - the CSRF tokens not showing up in the form when I clearly had

Re: CSRF token not adding hidden form field

2010-06-10 Thread Joel Klabo
yeah, still 403. CSRF token missing or incorrect. On Jun 10, 7:20 pm, Lee Hinde wrote: > Is the error the same? > > > > On Thu, Jun 10, 2010 at 5:41 PM, joelklabo wrote: > > Still won't work. Here is my views.py: > > > def login(request): > >        c = {} > >        c.update(csrf(request)) > >

Re: CSRF token not adding hidden form field

2010-06-10 Thread Lee Hinde
Is the error the same? On Thu, Jun 10, 2010 at 5:41 PM, joelklabo wrote: > Still won't work. Here is my views.py: > > def login(request): >        c = {} >        c.update(csrf(request)) >        if request.POST: >                username = request.POST['username'] >                password = req

Re: CSRF token not adding hidden form field

2010-06-10 Thread joelklabo
Still won't work. Here is my views.py: def login(request): c = {} c.update(csrf(request)) if request.POST: username = request.POST['username'] password = request.POST['password'] else: request = 'it is not there.'

Re: CSRF token not adding hidden form field

2010-06-10 Thread Lee Hinde
You need to add: from django.core.context_processors import csrf at the top of Views.py and c = {} c.update(csrf(request)) to each response/view since you're using render_to_response On Thu, Jun 10, 2010 at 8:10 AM, joelklabo wrote: > This is my source on GitHub if anyone is intereste

Re: CSRF token not adding hidden form field

2010-06-10 Thread joelklabo
This is my source on GitHub if anyone is interested: http://github.com/joelklabo/Brooski On Jun 10, 8:00 am, joelklabo wrote: > This is my urls.py: > >         (r'^site_media/(?P.*)$', 'django.views.static.serve', > {'document_root': settings.MEDIA_ROOT}), >     (r'^$', feed), >     (r'^admin/',

Re: CSRF token not adding hidden form field

2010-06-10 Thread joelklabo
This is my urls.py: (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), (r'^$', feed), (r'^admin/', include(admin.site.urls)), (r'^accounts/login/$', '.contrib.auth.views.login', {'template_name': 'base.html'}), (r'^accoun

Re: CSRF token not adding hidden form field

2010-06-09 Thread Roshan Mathews
On Thu, Jun 10, 2010 at 11:45, joelklabo wrote: > Looks like it did something, I didn't get a 403 but I got this error: > Okay, so it seems, 'django.middleware.csrf.CsrfResponseMiddleware' is not required. Please remove that. Are your forms working without csrf protection turned on? That stack

Re: CSRF token not adding hidden form field

2010-06-09 Thread Kenneth Gonsalves
On Thursday 10 June 2010 11:37:36 Roshan Mathews wrote: > On Thu, Jun 10, 2010 at 11:08, joelklabo wrote: > > MIDDLEWARE_CLASSES = ( > >'django.middleware.common.CommonMiddleware', > >'django.contrib.sessions.middleware.SessionMiddleware', > >'django.middleware.csrf.CsrfViewMiddleware'

Re: CSRF token not adding hidden form field

2010-06-09 Thread joelklabo
Looks like it did something, I didn't get a 403 but I got this error: Traceback: File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response 91. request.path_info) File "/Library/Python/2.6/site-packages/django/core/urlresolvers.py" in resolve

Re: CSRF token not adding hidden form field

2010-06-09 Thread Roshan Mathews
On Thu, Jun 10, 2010 at 11:08, joelklabo wrote: > MIDDLEWARE_CLASSES = ( >    'django.middleware.common.CommonMiddleware', >    'django.contrib.sessions.middleware.SessionMiddleware', >    'django.middleware.csrf.CsrfViewMiddleware', >    'django.contrib.auth.middleware.AuthenticationMiddleware',

Re: CSRF token not adding hidden form field

2010-06-09 Thread joelklabo
This is the login view. I tried to simplify it as much as I possibly could. def login(request): return render_to_response('base.html', context_instance = RequestContext(request)) the form in the template looks like this: {% csrf_token %}

Re: CSRF token not adding hidden form field

2010-06-09 Thread Lee Hinde
On Wed, Jun 9, 2010 at 6:08 PM, joelklabo wrote: > The error I am getting is: "CSRF token missing or incorrect" I went > and looked in the source for the place where it gives that error and > it was this point: > > request_csrf_token = request.POST.get('csrfmiddlewaretoken', None) > if request_csr

Re: CSRF token not adding hidden form field

2010-06-09 Thread joelklabo
The error I am getting is: "CSRF token missing or incorrect" I went and looked in the source for the place where it gives that error and it was this point: request_csrf_token = request.POST.get('csrfmiddlewaretoken', None) if request_csrf_token != csrf_token: if cookie_is_new: # probab

CSRF token not adding hidden form field

2010-06-09 Thread joelklabo
I have added the {% csrf_token %} to my template. and I have the django.middleware.csrf.CsrfViewMiddleware installed. I am on Django 1.2.1 but I keep getting 403 errors. And, when I view the source of my page there is no hidden form field. No sign of the token. -- You received this message becaus