mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Merge branch 'rm_banissement' into 'master'
Rm banissement See merge request federez/re2o!173
This commit is contained in:
commit
23001bf323
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