Add description field to questions

This commit is contained in:
RunasSudo 2019-01-14 17:55:24 +11:00
parent 2011749836
commit 9c2c0cf108
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,5 @@
# Eos - Verifiable elections
# Copyright © 2017 RunasSudo (Yingtong Li)
# Copyright © 2017-2019 RunasSudo (Yingtong Li)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -107,14 +107,15 @@ class UserVoter(Voter):
return self.user.name
class Question(EmbeddedObject):
_ver = StringField(default='0.7')
prompt = StringField()
description = StringField()
class Result(EmbeddedObject):
pass
class ListChoiceQuestion(Question):
_ver = StringField(default='0.5')
choices = EmbeddedObjectListField()
min_choices = IntField()
max_choices = IntField()

View File

@ -18,6 +18,10 @@
<h2>{{ questionNum + 1 }}. {{ election.questions.__getitem__(questionNum).prompt }}</h2>
{% if election.questions.__getitem__(questionNum).description %}
<p>{{ election.questions.__getitem__(questionNum).description | urlize | safe }}</p>
{% endif %}
<p><small>
Vote for
{% if election.questions.__getitem__(questionNum).min_choices == election.questions.__getitem__(questionNum).max_choices %}

View File

@ -18,6 +18,10 @@
<h2>{{ questionNum + 1 }}. {{ election.questions.__getitem__(questionNum).prompt }}</h2>
{% if election.questions.__getitem__(questionNum).description %}
<p>{{ election.questions.__getitem__(questionNum).description | urlize | safe }}</p>
{% endif %}
<p><small>
Vote for
{% if election.questions.__getitem__(questionNum).min_choices == election.questions.__getitem__(questionNum).max_choices %}