Convert indent with space, fix populate and add an s

This commit is contained in:
Antoine Bartuccio 2016-12-22 01:57:17 +01:00
parent a27fd267d7
commit 97f835eb4e
3 changed files with 157 additions and 157 deletions

View File

@ -346,7 +346,7 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
date_of_birth="1942-06-12") date_of_birth="1942-06-12")
sli.set_password("plop") sli.set_password("plop")
sli.save() sli.save()
skia.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id] sli.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
sli.save() sli.save()
sli_profile_path = os.path.join(root_path, 'core/fixtures/images/5.jpg') sli_profile_path = os.path.join(root_path, 'core/fixtures/images/5.jpg')
with open(sli_profile_path, 'rb') as f: with open(sli_profile_path, 'rb') as f:

View File

@ -18,10 +18,10 @@ class Election(models.Model):
start_date = models.DateTimeField(_('start date'), blank=False) start_date = models.DateTimeField(_('start date'), blank=False)
end_date = models.DateTimeField(_('end date'), blank=False) end_date = models.DateTimeField(_('end date'), blank=False)
edit_groups = models.ManyToManyField(Group, related_name="editable_elections", verbose_name=_("edit group"), blank=True) edit_groups = models.ManyToManyField(Group, related_name="editable_elections", verbose_name=_("edit groups"), blank=True)
view_groups = models.ManyToManyField(Group, related_name="viewable_elections", verbose_name=_("view group"), blank=True) view_groups = models.ManyToManyField(Group, related_name="viewable_elections", verbose_name=_("view groups"), blank=True)
vote_groups = models.ManyToManyField(Group, related_name="votable_elections", verbose_name=_("vote group"), blank=True) vote_groups = models.ManyToManyField(Group, related_name="votable_elections", verbose_name=_("vote groups"), blank=True)
candidature_groups = models.ManyToManyField(Group, related_name="candidate_elections", verbose_name=_("candidature group"), blank=True) candidature_groups = models.ManyToManyField(Group, related_name="candidate_elections", verbose_name=_("candidature groups"), blank=True)
def __str__(self): def __str__(self):
return self.title return self.title

View File

@ -8,31 +8,31 @@
{{ super() -}} {{ super() -}}
<style type="text/css"> <style type="text/css">
time { time {
font-weight: bolder; font-weight: bolder;
} }
th { th {
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;
border: solid 1px darkgrey; border: solid 1px darkgrey;
border-collapse: collapse; border-collapse: collapse;
vertical-align: top; vertical-align: top;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.election__title { .election__title {
margin: 0; margin: 0;
} }
.election__description { .election__description {
margin: 0; margin: 0;
margin-top: 5px; margin-top: 5px;
} }
.election__details { .election__details {
margin: 0; margin: 0;
margin-bottom: 5px; margin-bottom: 5px;
} }
.role { .role {
@ -40,214 +40,214 @@ th {
} }
.role .role__title { .role .role__title {
background: lightgrey; background: lightgrey;
} }
.role__multiple-choices { .role__multiple-choices {
color: darkgreen; color: darkgreen;
} }
.role .role_candidates { .role .role_candidates {
background: white; background: white;
} }
.list-per-role { .list-per-role {
padding: 5px; padding: 5px;
max-width: 310px; max-width: 310px;
} }
.list-per-role__candidates { .list-per-role__candidates {
list-style: none; list-style: none;
margin: 0; margin: 0;
} }
.list-per-role__candidate:not(:last-child) { .list-per-role__candidate:not(:last-child) {
margin-bottom: 5px; margin-bottom: 5px;
} }
.candidate { .candidate {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.candidate__picture-wrapper { .candidate__picture-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 150px; width: 150px;
height: 150px; height: 150px;
background-color: lightgrey; background-color: lightgrey;
} }
.candidate__picture { .candidate__picture {
max-width: 150px; max-width: 150px;
max-height: 150px; max-height: 150px;
} }
.candidate__infos { .candidate__infos {
margin-left: 5px; margin-left: 5px;
} }
.candidate__full-name { .candidate__full-name {
display: block; display: block;
font-weight: bolder; font-weight: bolder;
} }
.candidate__nick-name { .candidate__nick-name {
font-style: italic; font-style: italic;
} }
.candidate__program { .candidate__program {
display: block; display: block;
margin-top: 5px; margin-top: 5px;
} }
.candidate__vote-input { .candidate__vote-input {
position: absolute; position: absolute;
border: 0; border: 0;
height: 1px; height: 1px;
width: 1px; width: 1px;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
clip: rect(0, 0, 0, 0); clip: rect(0, 0, 0, 0);
} }
.candidate__vote-choice { .candidate__vote-choice {
margin-top: 5px; margin-top: 5px;
padding: 15px; padding: 15px;
border: solid 1px darkgrey; border: solid 1px darkgrey;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.candidate__vote-choice:hover, .candidate__vote-choice:focus { .candidate__vote-choice:hover, .candidate__vote-choice:focus {
background: lightgrey; background: lightgrey;
} }
.candidate__vote-input:checked + .candidate__vote-choice { .candidate__vote-input:checked + .candidate__vote-choice {
border-width: 2px; border-width: 2px;
border-color: darkgreen; border-color: darkgreen;
color: darkgreen; color: darkgreen;
font-weight: bolder; font-weight: bolder;
} }
.candidate__vote-input:checked + .candidate__vote-choice:hover, .candidate__vote-input:checked + .candidate__vote-choice:hover,
.candidate__vote-input:checked + .candidate__vote-choice:focus { .candidate__vote-input:checked + .candidate__vote-choice:focus {
background: palegreen; background: palegreen;
} }
.election__sumbit-section { .election__sumbit-section {
margin-top: 5px; margin-top: 5px;
} }
.election__sumbit-button { .election__sumbit-button {
display: block; display: block;
width: 100%; width: 100%;
padding: 20px; padding: 20px;
background: white; background: white;
border: solid 15px orange; border: solid 15px orange;
text-align: center; text-align: center;
font-size: 200%; font-size: 200%;
font-weight: bolder; font-weight: bolder;
cursor: pointer; cursor: pointer;
} }
</style> </style>
{%- endblock %} {%- endblock %}
{% block content %} {% block content %}
<h3 class="election__title">{{ object.title }}</h3> <h3 class="election__title">{{ object.title }}</h3>
<p class="election__description">{{ object.description }}</p> <p class="election__description">{{ object.description }}</p>
<hr> <hr>
<section> <section>
<p class="election__details"> <p class="election__details">
{% trans %}Polls close {% endtrans %} {% trans %}Polls close {% endtrans %}
<time datetime="{{ election.end_date }}">{{ election.end_date|date("l d F Y") }}</time> at <time>{{ election.end_date|time("G:i") }}</time> <time datetime="{{ election.end_date }}">{{ election.end_date|date("l d F Y") }}</time> at <time>{{ election.end_date|time("G:i") }}</time>
</p> </p>
{# {%- if object.has_voted(request.user) %} {# {%- if object.has_voted(request.user) %}
<p class="election__elector-infos"> <p class="election__elector-infos">
<span>{% trans %}You already have submitted your vote.{% endtrans %}</span> <span>{% trans %}You already have submitted your vote.{% endtrans %}</span>
</p> </p>
{%- endif %} {%- endif %}
#} </section> #} </section>
<section> <section>
<table> <table>
{%- set election_lists = object.election_list.all() -%} {%- set election_lists = object.election_list.all() -%}
<caption></caption> <caption></caption>
<thead> <thead>
{%- for election_list in election_lists %} {%- for election_list in election_lists %}
<th>{{election_list.title}}</th> <th>{{election_list.title}}</th>
{%- endfor %} {%- endfor %}
<th>{% trans %}Blank vote{% endtrans %}</th> <th>{% trans %}Blank vote{% endtrans %}</th>
</thead> </thead>
{%- for role in object.role.all() %} {%- for role in object.role.all() %}
<tbody class="role"> <tbody class="role">
<tr class="role__title"> <tr class="role__title">
<td colspan="{{election_lists.count() + 1}}"> <td colspan="{{election_lists.count() + 1}}">
<span>{{role.title}}</span> <span>{{role.title}}</span>
{%- if role.max_choice > 1 %} {%- if role.max_choice > 1 %}
<strong class="role__multiple-choices">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong> <strong class="role__multiple-choices">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong>
{%- endif %} {%- endif %}
</td> </td>
</tr> </tr>
<tr class="role_candidates"> <tr class="role_candidates">
{%- for election_list in election_lists %} {%- for election_list in election_lists %}
<td class="list-per-role"> <td class="list-per-role">
<ul class="list-per-role__candidates"> <ul class="list-per-role__candidates">
{%- for candidature in election_list.candidature.filter(role=role) %} {%- for candidature in election_list.candidature.filter(role=role) %}
<li class="list-per-role__candidate"> <li class="list-per-role__candidate">
<figure class="candidate"> <figure class="candidate">
<div class="candidate__picture-wrapper"> <div class="candidate__picture-wrapper">
{%- if candidature.user.profile_pict %} {%- if candidature.user.profile_pict %}
<img class="candidate__picture" src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}"> <img class="candidate__picture" src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}">
{%- endif %} {%- endif %}
</div> </div>
<figcaption class="candidate__infos"> <figcaption class="candidate__infos">
<cite class="candidate__full-name">{{ candidature.user.first_name }} <em class="candidate__nick-name">{{candidature.user.nick_name or ''}} </em>{{ candidature.user.last_name }}</cite> <cite class="candidate__full-name">{{ candidature.user.first_name }} <em class="candidate__nick-name">{{candidature.user.nick_name or ''}} </em>{{ candidature.user.last_name }}</cite>
<q class="candidate__program">{{ candidature.program or '' }}</q> <q class="candidate__program">{{ candidature.program or '' }}</q>
</figcaption> </figcaption>
</figure> </figure>
{%- if object.is_active %} {%- if object.is_active %}
<input id="id" class="candidate__vote-input" type="radio" name="vote"> <input id="id" class="candidate__vote-input" type="radio" name="vote">
<label for="id" class="candidate__vote-choice"> <label for="id" class="candidate__vote-choice">
<span>{% trans %}Choose{% endtrans %} {{ candidature.user.nick_name or candidature.user.first_name }}</span> <span>{% trans %}Choose{% endtrans %} {{ candidature.user.nick_name or candidature.user.first_name }}</span>
</label> </label>
{% endif %} {% endif %}
</li> </li>
{%- endfor %} {%- endfor %}
</ul> </ul>
</td> </td>
{%- endfor %} {%- endfor %}
<td class="list-per-role"> <td class="list-per-role">
{%- if object.is_active %} {%- if object.is_active %}
<input id="id" class="candidate__vote-input" type="radio" name="vote"> <input id="id" class="candidate__vote-input" type="radio" name="vote">
<label for="id" class="candidate__vote-choice"> <label for="id" class="candidate__vote-choice">
<span>{% trans %}Choose blank vote{% endtrans %}</span> <span>{% trans %}Choose blank vote{% endtrans %}</span>
</label> </label>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
</tbody> </tbody>
{%- endfor %} {%- endfor %}
</table> </table>
</section> </section>
<section class="election__sumbit-section"> <section class="election__sumbit-section">
<button class="election__sumbit-button">{% trans %}Submit the vote !{% endtrans %}</button> <button class="election__sumbit-button">{% trans %}Submit the vote !{% endtrans %}</button>
</section> </section>
<a href="{{url('election:create_list')}}">{% trans %}Add a new list{% endtrans %}</a> <a href="{{url('election:create_list')}}">{% trans %}Add a new list{% endtrans %}</a>
<a href="{{url('election:create_role')}}">{% trans %}Add a new role{% endtrans %}</a> <a href="{{url('election:create_role')}}">{% trans %}Add a new role{% endtrans %}</a>
<form action="{{url('election:candidate', election_id=object.id)}}" method="post">{{candidate_form}} <form action="{{url('election:candidate', election_id=object.id)}}" method="post">{{candidate_form}}
{% csrf_token %} {% csrf_token %}
<p><input type="submit" value="{% trans %}Candidate{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Candidate{% endtrans %}" /></p>
</form> </form>
<form action="{{url('election:vote', election_id=object.id)}}" method="post"> <form action="{{url('election:vote', election_id=object.id)}}" method="post">
{{election_form.as_p()}} {{election_form.as_p()}}
<p><input type="submit" value="{% trans %}Vote{% endtrans %}" /></p> <p><input type="submit" value="{% trans %}Vote{% endtrans %}" /></p>
{% csrf_token %} {% csrf_token %}
</form> </form>
{% endblock %} {% endblock %}