From: Aleksander Ɓukasz Date: Tue, 5 Nov 2013 11:22:07 +0000 (+0100) Subject: Backdoor testing url for contest form X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/7ccedc9d976cd5b312760bed776ff096bb9463d5 Backdoor testing url for contest form --- 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: