gestioCOF/cof/templates/survey_status.html
Martin Pépin 1aed36330f Write modern-style urls
- Proper use of include
- Defining namespaces (I do not use them for now because many urls are
  going to change)
- Do not try to reverse with old-style references: 'cof.views.XXX'
2017-02-23 01:52:55 +01:00

52 lines
2.4 KiB
HTML

{% extends "base_title.html" %}
{% load utils %}
{% block page_size %}col-sm-8{% endblock %}
{% block realcontent %}
<h2>Sondage: {{ survey.title }}{% if user.is_staff %} <a class="title-link" href="{% url 'admin:cof_survey_change' survey.id %}"><span class="glyphicon glyphicon-link" aria-hidden="true"></span> Administration</a>{% endif %}</h2>
{% if survey.details %}
<p>{{ survey.details }}</p>
<hr/>
{% endif %}
<h3>Filtres</h3>
{% include "tristate_js.html" %}
<form method="post" action="{% url 'survey.status' survey.id %}">
{% csrf_token %}
{{ form.as_p }}
<input style="margin-top:10px;" type="submit" class="btn btn-primary" value="Filtrer" />
</form>
<hr/>
<h3>Résultats globaux</h3>
<br/>
{% for question in questions %}
<h4>{{ question.question }}</h4>
<ul>
{% for answer in question.answers.all %}
<li>{{ answer.answer }} : {{ answers_count|key:answer.id }}</li>
{% endfor %}
</ul>
{% endfor %}
<hr/>
<h3>Réponses individuelles</h3>
<ul>
{% for user_answer in user_answers %}{% with user_answer.user as auser %}
{% if user_answer.answers.all %}
<li>
{% if auser.first_name and auser.last_name %}{{ auser.first_name }} {{ auser.last_name }}
{% else %}<tt>{{ auser.username }}</tt>{% endif %} :
<ul>
{% for answer in user_answer.answers.all %}
<li>{{ answer.survey_question.question }} : {{ answer.answer }}</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endwith %}{% endfor %}
</ul>
<hr/>
<h3>Mailing list</h3>
<textarea style="width: 100%; height: 100px; margin-top: 10px;">
{% spaceless %}{% for user_answer in user_answers %}{% with user_answer.user as auser %}{% if user_answer.answers.all %}{% if auser.email %}{{ auser.email }}{% else %}{{ auser.username }}{% endif %}, {% endif %}{% endwith %}{% endfor %}
{% endspaceless %}</textarea>
{% endblock %}