8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00

Button to remove port of a room

This commit is contained in:
Gabriel Detraz 2019-09-21 16:25:05 +02:00 committed by klafyvel
parent 2df79830b6
commit dfe15ec23d
3 changed files with 20 additions and 2 deletions

View file

@ -42,6 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% trans "Details" %}</th>
<th>{% trans "End of subscription on" %}</th>
<th>{% trans "Internet access" %}</th>
<th>{% trans "Action" %}</th>
</tr>
</thead>
{% for room in room_list %}
@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{% if room.port_set.all %}<span class="label label-success">AURORE{% else %}<span class="label label-danger">{% trans "Other operator" %}{% endif %}</span></td>
<td>{% if room.adherent %}<a href="{% url 'users:profil' room.adherent.id%}">{{ room.adherent }}</a>{% else %} {% trans "Aucun" %}{% endif %}</td>
<td>{{ room.details }}</td>
<td>{% if room.adherent.is_adherent %}{{ room.adherent.end_adhesion }}{% else %}{% trans "Not a member" %}{% endif %}</td>
<td>{% if room.adherent.is_adherent %}<i class="text-success">{% else %}<i class="text-danger">{% endif %}{% if room.adherent.end_adhesion %}{{ room.adherent.end_adhesion}}{% else %}{% trans "No member" %}{% endif %}</i></td>
<td>
{% if room.adherent.has_access == True %}
<i class="text-success">{% trans "Active" %}</i>
@ -59,6 +60,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="text-danger">{% trans "Disabled" %}</i>
{% endif %}
</td>
<td>
{% if room.port_set.all %}
<a href="{% url 'multi_op:disconnect-room' room.id %}" class="btn btn-danger btn-sm" role="button"><i class="fa fa-expand"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -34,5 +34,5 @@ urlpatterns = [
url(r'^(?P<dormitoryid>[0-9]+)$', views.aff_state_dormitory, name='aff-state-dormitory'),
url(r'^pending-connection$', views.aff_pending_connection, name='aff-pending-connection'),
url(r'^pending-disconnection$', views.aff_pending_disconnection, name='aff-pending-disconnection'),
# url(r'^multi_op/edit-preferences-multiop$', views.edit_preferences, name='edit-preferences-multiop'),
url(r'^disconnect-room/(?P<roomid>[0-9]+)$', views.disconnect_room, name='disconnect-room'),
]

View file

@ -142,6 +142,18 @@ def aff_pending_disconnection(request):
)
@login_required
@can_edit(Room)
def disconnect_room(request, room, roomid):
"""Action of disconnecting a room"""
room.port_set.clear()
room.save()
messages.success(request,'Room %s disconnected' % room)
return redirect(reverse(
'multi_op:aff-pending-disconnection'
))
def edit_preferences(request):
""" View to edit the settings of the tickets """