#169 Admin on teams

* adds admin column on team index view
* refactors Team model, so multiple members can become admins
* adds team migration for switch from fkey->m2m structure
* renames 'Group' to 'Permission' on user index view to avoid confusion between 'Groups' and Teams
* adds new autocomplete route for team-admin selection based on already selected members of the TeamForm
This commit is contained in:
2022-05-30 14:35:31 +02:00
parent eb3b9eb5c1
commit 8aa3fbd97a
16 changed files with 258 additions and 138 deletions

View File

@@ -18,7 +18,7 @@
<td>{{user.email}}</td>
</tr>
<tr>
<th scope="row">{% trans 'Groups' %}</th>
<th scope="row">{% trans 'Permissions' %}</th>
<td>
{% for group in user.groups.all %}
<span class="badge badge-pill rlp-r">{% trans group.name %}</span>

View File

@@ -28,6 +28,7 @@
<th scope="col" class="align-middle">{% trans 'Name' %}</th>
<th scope="col" class="align-middle w-20">{% trans 'Description' %}</th>
<th scope="col" class="align-middle">{% trans 'Members' %}</th>
<th scope="col" class="align-middle">{% trans 'Administrator' %}</th>
<th scope="col" class="align-middle">{% trans 'Action' %}</th>
</tr>
</thead>
@@ -45,11 +46,16 @@
<span class="badge badge-pill rlp-r">{{member.username}}</span>
{% endfor %}
</td>
<td>
{% for admin in team.admins.all %}
<span class="badge badge-pill rlp-r">{{admin.username}}</span>
{% endfor %}
</td>
<td>
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-leave' team.id %}" title="{% trans 'Leave team' %}">
{% fa5_icon 'sign-out-alt' %}
</button>
{% if team.admin == user %}
{% if user in team.admins.all %}
<button class="btn rlp-r btn-modal" data-form-url="{% url 'user:team-edit' team.id %}" title="{% trans 'Edit team' %}">
{% fa5_icon 'edit' %}
</button>