On peut changer de respos
Tout se fait simplement depuis la vue `/clubs/membres/<club_name>`. Il est déconseillé de passer par l'interface admin.
This commit is contained in:
parent
ccc1c79101
commit
559ac5a39d
5 changed files with 51 additions and 11 deletions
|
@ -70,6 +70,7 @@
|
||||||
<li><a href="{% url "admin:index" %}">Administration générale</a></li>
|
<li><a href="{% url "admin:index" %}">Administration générale</a></li>
|
||||||
<li><a href="{% url "petits-cours-demandes-list" %}">Demandes de petits cours</a></li>
|
<li><a href="{% url "petits-cours-demandes-list" %}">Demandes de petits cours</a></li>
|
||||||
<li><a href="{% url "gestioncof.views.registration" %}">Inscription d'un nouveau membre</a></li>
|
<li><a href="{% url "gestioncof.views.registration" %}">Inscription d'un nouveau membre</a></li>
|
||||||
|
<li><a href="{% url "liste-clubs" %}">Gestion des clubs</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<h4>Évènements & Sondages</h4>
|
<h4>Évènements & Sondages</h4>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{% for club in owned_clubs %}
|
{% for club in owned_clubs %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url "membres-club" club.name %}">
|
<a href="{% url "membres-club" club.name %}">
|
||||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}{% empty %}pas de respo{% endfor %})
|
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}, {% empty %}pas de respo{% endfor %})
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
{% for club in other_clubs %}
|
{% for club in other_clubs %}
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}{% empty %}pas de respo{% endfor %})
|
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}, {% empty %}pas de respo{% endfor %})
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,20 +1,41 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
|
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>{{ club }}</h2>
|
<h2>{{ club }}</h2>
|
||||||
|
|
||||||
|
|
||||||
|
{% if club.respos.exists %}
|
||||||
|
<h3>Respo{{ club.respos.all|pluralize }}</h3>
|
||||||
|
<table class="table table-striped">
|
||||||
|
{% for member in club.respos.all %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ member }}</td>
|
||||||
|
<td>{{ member.email }}</td>
|
||||||
|
<td><a class="glyphicon glyphicon-arrow-down"
|
||||||
|
href="{% url "change-respo" club.name member.id %}"></a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<h3>Pas de respo</h3>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if club.membres.exists %}
|
{% if club.membres.exists %}
|
||||||
<h3>Liste des membres</h3>
|
<h3>Liste des membres</h3>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
{% for member in club.membres.all %}
|
{% for member in members_no_respo %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ member }}</td>
|
<td>{{ member }}</td>
|
||||||
<td>{{ member.email }}</td>
|
<td>{{ member.email }}</td>
|
||||||
</tr>
|
<td><a class="glyphicon glyphicon-arrow-up"
|
||||||
|
href="{% url "change-respo" club.name member.id %}"></a></td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
Ce club ne contient actuellement aucun membre.
|
Ce club ne comporte actuellement aucun membre.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -55,5 +55,7 @@ calendar_patterns = [
|
||||||
|
|
||||||
clubs_patterns = [
|
clubs_patterns = [
|
||||||
url(r'^membres/(?P<name>\w+)', views.membres_club, name='membres-club'),
|
url(r'^membres/(?P<name>\w+)', views.membres_club, name='membres-club'),
|
||||||
url(r'^liste', views.liste_clubs, name='liste-clubs')
|
url(r'^liste', views.liste_clubs, name='liste-clubs'),
|
||||||
|
url(r'^change_respo/(?P<club_name>\w+)/(?P<user_id>\d+)',
|
||||||
|
views.change_respo, name='change-respo'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -497,7 +497,23 @@ def membres_club(request, name):
|
||||||
if not request.user.profile.is_buro \
|
if not request.user.profile.is_buro \
|
||||||
and club not in user.clubs_geres.all():
|
and club not in user.clubs_geres.all():
|
||||||
return HttpResponseForbidden('<h1>Permission denied</h1>')
|
return HttpResponseForbidden('<h1>Permission denied</h1>')
|
||||||
return render(request, 'membres_clubs.html', {'club': club})
|
members_no_respo = club.membres.exclude(clubs_geres=club).all()
|
||||||
|
return render(request, 'membres_clubs.html',
|
||||||
|
{'club': club,
|
||||||
|
'members_no_respo': members_no_respo})
|
||||||
|
|
||||||
|
|
||||||
|
@buro_required
|
||||||
|
def change_respo(request, club_name, user_id):
|
||||||
|
club = get_object_or_404(Club, name=club_name)
|
||||||
|
user = get_object_or_404(User, id=user_id)
|
||||||
|
if user in club.respos.all():
|
||||||
|
club.respos.remove(user)
|
||||||
|
elif user in club.membres.all():
|
||||||
|
club.respos.add(user)
|
||||||
|
else:
|
||||||
|
raise Http404
|
||||||
|
return redirect('membres-club', name=club_name)
|
||||||
|
|
||||||
|
|
||||||
@cof_required
|
@cof_required
|
||||||
|
|
Loading…
Reference in a new issue