From 7ccedc9d976cd5b312760bed776ff096bb9463d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 5 Nov 2013 12:22:07 +0100 Subject: [PATCH 1/1] Backdoor testing url for contest form --- wtem/urls.py | 3 ++- wtem/views.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wtem/urls.py b/wtem/urls.py index 1dded94..c78e8bd 100644 --- a/wtem/urls.py +++ b/wtem/urls.py @@ -1,8 +1,9 @@ from django.conf.urls import patterns, url from django.conf import settings -from .views import main, form +from .views import main, form, form_during urlpatterns = patterns('', url(r'^$', main, name = 'wtem_main'), + url(r'^_test/(?P.*)/$', form_during), url(r'^(?P.*)/$', form, name = 'wtem_form') ) diff --git a/wtem/views.py b/wtem/views.py index 1647f09..89bf6c1 100644 --- a/wtem/views.py +++ b/wtem/views.py @@ -24,6 +24,11 @@ def form_after(request, key): return render(request, 'wtem/main_after.html') def form_during(request, key): + + if WTEM_CONTEST_STAGE != 'during': + if request.META['REMOTE_ADDR'] != getattr(settings, 'WTEM_CONTEST_IP_ALLOW', 'xxx'): + raise Http404 + try: submission = Submission.objects.get(key = key) except Submission.DoesNotExist: -- 2.20.1