fnp
/
koed-quiz.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused templates.
[koed-quiz.git]
/
apps
/
quiz
/
views.py
diff --git
a/apps/quiz/views.py
b/apps/quiz/views.py
index
037f0c5
..
3bd3a84
100644
(file)
--- a/
apps/quiz/views.py
+++ b/
apps/quiz/views.py
@@
-1,3
+1,7
@@
+# -*- coding: utf-8 -*-
+# This file is part of KOED-Quiz, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from django.shortcuts import get_object_or_404, render, redirect
from quiz.forms import QuestionForm
from django.shortcuts import get_object_or_404, render, redirect
from quiz.forms import QuestionForm
@@
-11,14
+15,14
@@
def question(request, slug=None):
else:
question = get_object_or_404(Quiz.current().question_set, slug=slug)
else:
question = get_object_or_404(Quiz.current().question_set, slug=slug)
- ticket = request.session.get('ticket')
+ ticket = request.session.get('ticket'
, []
)
valid = request.path in ticket
valid = request.path in ticket
- print ticket, valid
+
if valid:
cur_index = ticket.index(request.path)
if cur_index:
previous_url = ticket[cur_index - 1]
if valid:
cur_index = ticket.index(request.path)
if cur_index:
previous_url = ticket[cur_index - 1]
- el
se
:
+ el
if ticket
:
valid_url = ticket[-1]
if request.method == 'POST' and valid:
valid_url = ticket[-1]
if request.method == 'POST' and valid:
@@
-44,17
+48,16
@@
def question(request, slug=None):
def result(request, slug=None):
def result(request, slug=None):
- ticket = request.session
['ticket']
+ ticket = request.session
.get('ticket', [])
valid = request.path in ticket
if valid:
cur_index = ticket.index(request.path)
if cur_index:
previous_url = ticket[cur_index - 1]
valid = request.path in ticket
if valid:
cur_index = ticket.index(request.path)
if cur_index:
previous_url = ticket[cur_index - 1]
- el
se
:
+ el
if ticket
:
valid_url = ticket[-1]
valid_url = ticket[-1]
-
result = get_object_or_404(Quiz.current().result_set, slug=slug)
return render(request, "quiz/result_detail.html", locals())
result = get_object_or_404(Quiz.current().result_set, slug=slug)
return render(request, "quiz/result_detail.html", locals())