StrictUndefined + empty poll options issue fixed

This commit is contained in:
iou1name 2018-07-26 15:14:04 -04:00
parent 4c13607119
commit 41dae13d44
2 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
app.config['SESSION_TYPE'] = 'filesystem' app.config['SESSION_TYPE'] = 'filesystem'
app.jinja_env.trim_blocks = True app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True app.jinja_env.lstrip_blocks = True
#app.jinja_env.undefined = "StrictUndefined" app.jinja_env.undefined = "StrictUndefined"
Session(app) Session(app)
socketio.init_app(app) socketio.init_app(app)
paranoid = Paranoid(app) paranoid = Paranoid(app)

View File

@ -69,14 +69,14 @@
<col{% if quest_post[0] != open_post_id %} style="visibility: collapse;"{% endif %}/> <col{% if quest_post[0] != open_post_id %} style="visibility: collapse;"{% endif %}/>
<col/> <col/>
<col/> <col/>
{% for option in options[quest_post[0]] %} {% for option in options.get(quest_post[0], []) %}
<tr id="optionRow-{{ option[0] }}"> <tr id="optionRow-{{ option[0] }}">
<td class="pollCheckBox"> <td class="pollCheckBox">
<input type="checkbox" {% if ip_address in poll_votes[option[0]] %}checked="true"{% endif %} id="pollInput-{{ option[0] }}" onchange="pollVote({{ quest_post[0] }}, {{ option[0] }})"/> <input type="checkbox" {% if ip_address in poll_votes.get(option[0], []) %}checked="true"{% endif %} id="pollInput-{{ option[0] }}" onchange="pollVote({{ quest_post[0] }}, {{ option[0] }})"/>
<label for="pollInput-{{ option[0] }}"></label> <label for="pollInput-{{ option[0] }}"></label>
</td> </td>
<td class="option_text">{{ option[2] }}</td> <td class="option_text">{{ option[2] }}</td>
<td class="optionVotes">{{ poll_votes[option[0]]|length }}</td> <td class="optionVotes">{{ poll_votes.get(option[0], [])|length }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>