It is possible to show all questionniare questions when adding show_all=1 GET parameter.

It is useful for debugging purposes, when you want to see all questions rendered
on one screen.

Conflicts:
	questionnaire/views.py
EmailTemplateFixes
Piotr Szachewicz 2014-05-05 21:41:48 +02:00
parent be73a2f7e0
commit fab1c8b37a
2 changed files with 13 additions and 2 deletions

View File

@ -77,6 +77,12 @@ class Questionnaire(models.Model):
QuestionSet.objects.filter(questionnaire=self).order_by('sortid')
return self.__qscache
def questions(self):
questions = []
for questionset in self.questionsets():
questions += questionset.questions()
return questions
class Meta:
permissions = (
("export", "Can export questionnaire answers"),

View File

@ -235,7 +235,7 @@ def redirect_to_qs(runinfo):
if not questionset_satisfies_checks(runinfo.questionset, runinfo):
next = runinfo.questionset.next()
while next and not questionset_satisfies_checks(next, runinfo):
next = next.next()
@ -453,7 +453,12 @@ def show_questionnaire(request, runinfo, errors={}):
Also add the javascript dependency code.
"""
questions = runinfo.questionset.questions()
request.runinfo = runinfo
if request.GET.get('show_all') == '1': # for debugging purposes.
questions = runinfo.questionset.questionnaire.questions()
else:
questions = runinfo.questionset.questions()
qlist = []
jsinclude = [] # js files to include