From 1d3d941cdc4cf2d2b4c25ca40e3f1a974fe9ac66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 18 Nov 2013 15:12:47 +0100 Subject: [PATCH 1/1] Validate user key even before the contest --- wtem/templates/wtem/key_not_found_before.html | 9 +++++++++ wtem/views.py | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 wtem/templates/wtem/key_not_found_before.html diff --git a/wtem/templates/wtem/key_not_found_before.html b/wtem/templates/wtem/key_not_found_before.html new file mode 100644 index 0000000..d1351dd --- /dev/null +++ b/wtem/templates/wtem/key_not_found_before.html @@ -0,0 +1,9 @@ +{% extends 'base_super.html' %} + +{% block body %} +

Wielki Turniej Edukacji Medialnej

+

Niepoprawny link

+ +

Podany adres jest niepoprawny. Żeby móc rozwiązywać zadania Turnieju musisz przejść pod dokłanie ten sam adres co podany w wysłanej do Ciebie wiadomości e-mail. Jeśli masz z tym kłopot, skontaktuj się z nami pod adresem edukacjamedialna@nowoczesnapolska.org.pl.

+ +{% endblock %} \ No newline at end of file diff --git a/wtem/views.py b/wtem/views.py index 546ec5b..38a4985 100644 --- a/wtem/views.py +++ b/wtem/views.py @@ -17,7 +17,12 @@ def form(request, key): return globals()['form_' + WTEM_CONTEST_STAGE](request, key) def form_before(request, key): - return render(request, 'wtem/main_before.html') + try: + submission = Submission.objects.get(key = key) + except: + return render(request, 'wtem/key_not_found_before.html') + else: + return render(request, 'wtem/main_before.html') def form_after(request, key): return render(request, 'wtem/main_after.html') -- 2.20.1