mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-14 02:03:22 +00:00
ef968f3673
* Better usage of cache for group retrieval * Cache clearing on object deletion or update * replace signals by save and delete override * add is_anonymous check in is_owned_by Add in many is_owned_by(self, user) methods that user is not anonymous. Since many of those functions do db queries, this should reduce a little bit the load of the db. * Stricter usage of User.is_in_group Constrain the parameters that can be passed to the function to make sure only a str or an int can be used. Also force to explicitly specify if the group id or the group name is used. * write test and correct bugs * remove forgotten populate commands * Correct test
83 lines
3.1 KiB
Django/Jinja
83 lines
3.1 KiB
Django/Jinja
{% extends "core/base.jinja" %}
|
|
{% from 'core/macros.jinja' import user_profile_link, select_all_checkbox %}
|
|
|
|
{% block content %}
|
|
<h2>{% trans %}Club members{% endtrans %}</h2>
|
|
{% if members %}
|
|
<form action="{{ url('club:club_members', club_id=club.id) }}" id="users_old" method="post">
|
|
{% csrf_token %}
|
|
{% set users_old = dict(form.users_old | groupby("choice_label")) %}
|
|
{% if users_old %}
|
|
{{ select_all_checkbox("users_old") }}
|
|
<p></p>
|
|
{% endif %}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<td>{% trans %}User{% endtrans %}</td>
|
|
<td>{% trans %}Role{% endtrans %}</td>
|
|
<td>{% trans %}Description{% endtrans %}</td>
|
|
<td>{% trans %}Since{% endtrans %}</td>
|
|
{% if users_old %}
|
|
<td>{% trans %}Mark as old{% endtrans %}</td>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for m in members %}
|
|
<tr>
|
|
<td>{{ user_profile_link(m.user) }}</td>
|
|
<td>{{ settings.SITH_CLUB_ROLES[m.role] }}</td>
|
|
<td>{{ m.description }}</td>
|
|
<td>{{ m.start_date }}</td>
|
|
{% if users_old %}
|
|
<td>
|
|
{% set user_old = users_old[m.user.get_display_name()] %}
|
|
{% if user_old %}
|
|
{{ user_old[0].tag() }}
|
|
{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{{ form.users_old.errors }}
|
|
{% if users_old %}
|
|
<p></p>
|
|
<input type="submit" name="submit" value="{% trans %}Mark as old{% endtrans %}">
|
|
{% endif %}
|
|
</form>
|
|
{% else %}
|
|
<p>{% trans %}There are no members in this club.{% endtrans %}</p>
|
|
{% endif %}
|
|
<form action="{{ url('club:club_members', club_id=club.id) }}" id="add_users" method="post">
|
|
{% csrf_token %}
|
|
{{ form.non_field_errors() }}
|
|
<p>
|
|
{{ form.users.errors }}
|
|
<label for="{{ form.users.id_for_label }}">{{ form.users.label }} :</label>
|
|
{{ form.users }}
|
|
<span class="helptext">{{ form.users.help_text }}</span>
|
|
</p>
|
|
<p>
|
|
{{ form.role.errors }}
|
|
<label for="{{ form.role.id_for_label }}">{{ form.role.label }} :</label>
|
|
{{ form.role }}
|
|
</p>
|
|
{% if form.start_date %}
|
|
<p>
|
|
{{ form.start_date.errors }}
|
|
<label for="{{ form.start_date.id_for_label }}">{{ form.start_date.label }} :</label>
|
|
{{ form.start_date }}
|
|
</p>
|
|
{% endif %}
|
|
<p>
|
|
{{ form.description.errors }}
|
|
<label for="{{ form.description.id_for_label }}">{{ form.description.label }} :</label>
|
|
{{ form.description }}
|
|
</p>
|
|
<p><input type="submit" value="{% trans %}Add{% endtrans %}" /></p>
|
|
</form>
|
|
{% endblock %}
|