From d7ffb0bcc5cfb20a93652b8887be91590ef543eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 14 Nov 2013 14:29:04 +0100 Subject: [PATCH 1/1] csrf_exempt for contest form --- wtem/templates/wtem/main.html | 1 - wtem/views.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wtem/templates/wtem/main.html b/wtem/templates/wtem/main.html index 61ad395..4f80064 100644 --- a/wtem/templates/wtem/main.html +++ b/wtem/templates/wtem/main.html @@ -48,7 +48,6 @@ Zespół Edukacji Medialnej, Fundacja Nowoczesna Polska

-{% csrf_token %} {% for exercise in exercises %} {% with 'wtem/exercises/'|add:exercise.type|add:'.html' as template_name %} diff --git a/wtem/views.py b/wtem/views.py index 551a781..b6e21b0 100644 --- a/wtem/views.py +++ b/wtem/views.py @@ -4,6 +4,7 @@ from django.shortcuts import render from django.utils import simplejson from django.conf import settings from django.http import Http404, HttpResponseForbidden +from django.views.decorators.csrf import csrf_exempt from .models import Submission, DEBUG_KEY, exercises from .forms import WTEMForm @@ -11,6 +12,7 @@ from .forms import WTEMForm WTEM_CONTEST_STAGE = getattr(settings, 'WTEM_CONTEST_STAGE', 'before') +@csrf_exempt def form(request, key): return globals()['form_' + WTEM_CONTEST_STAGE](request, key) @@ -20,6 +22,7 @@ def form_before(request, key): def form_after(request, key): return render(request, 'wtem/main_after.html') +@csrf_exempt def form_during(request, key): if WTEM_CONTEST_STAGE != 'during': -- 2.20.1