mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Ajout d'un bouton de supression des banissements
This commit is contained in:
parent
f6b04a186a
commit
4252f84398
3 changed files with 22 additions and 0 deletions
|
@ -47,6 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{ ban.date_start }}</td>
|
||||
<td>{{ ban.date_end }}</td>
|
||||
<td class="text-right">
|
||||
{% can_delete ban %}
|
||||
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
|
||||
{% acl_end %}
|
||||
{% can_edit ban %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
|
||||
{% acl_end %}
|
||||
|
|
|
@ -55,6 +55,7 @@ urlpatterns = [
|
|||
name='del-serviceuser'),
|
||||
url(r'^add_ban/(?P<userid>[0-9]+)$', views.add_ban, name='add-ban'),
|
||||
url(r'^edit_ban/(?P<banid>[0-9]+)$', views.edit_ban, name='edit-ban'),
|
||||
url(r'^del-ban/(?P<banid>[0-9]+)$', views.del_ban, name='del-ban'),
|
||||
url(r'^add_whitelist/(?P<userid>[0-9]+)$',
|
||||
views.add_whitelist,
|
||||
name='add-whitelist'),
|
||||
|
|
|
@ -404,6 +404,24 @@ def edit_ban(request, ban_instance, **_kwargs):
|
|||
request
|
||||
)
|
||||
|
||||
@login_required
|
||||
@can_delete(Ban)
|
||||
def del_ban(request, ban, **_kwargs):
|
||||
""" Supprime un banissement"""
|
||||
if request.method == "POST":
|
||||
ban.delete()
|
||||
messages.success(request, "Le banissement a été supprimé")
|
||||
return redirect(reverse(
|
||||
'users:profil',
|
||||
kwargs={'userid': str(ban.user.id)}
|
||||
))
|
||||
return form(
|
||||
{'objet': ban, 'objet_name': 'ban'},
|
||||
'users/delete.html',
|
||||
request
|
||||
)
|
||||
|
||||
|
||||
|
||||
@login_required
|
||||
@can_create(Whitelist)
|
||||
|
|
Loading…
Reference in a new issue