diff --git a/users/templates/users/aff_whitelists.html b/users/templates/users/aff_whitelists.html
index 099d4b39..01a9efdd 100644
--- a/users/templates/users/aff_whitelists.html
+++ b/users/templates/users/aff_whitelists.html
@@ -47,6 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ whitelist.date_start }} |
{{ whitelist.date_end }} |
+ {% can_delete whitelist %}
+ {% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
+ {% acl_end %}
{% can_edit whitelist %}
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
{% acl_end %}
diff --git a/users/urls.py b/users/urls.py
index 23193983..724601c3 100644
--- a/users/urls.py
+++ b/users/urls.py
@@ -62,6 +62,9 @@ urlpatterns = [
url(r'^edit_whitelist/(?P[0-9]+)$',
views.edit_whitelist,
name='edit-whitelist'),
+ url(r'^del_whitelist/(?P[0-9]+)$',
+ views.del_whitelist,
+ name='del-whitelist'),
url(r'^add_school/$', views.add_school, name='add-school'),
url(r'^edit_school/(?P[0-9]+)$',
views.edit_school,
diff --git a/users/views.py b/users/views.py
index 3cc568a8..fcb44f65 100644
--- a/users/views.py
+++ b/users/views.py
@@ -478,6 +478,23 @@ def edit_whitelist(request, whitelist_instance, **_kwargs):
)
+@login_required
+@can_delete(Whitelist)
+def del_whitelist(request, whitelist, **_kwargs):
+ """ Supprime un acces gracieux"""
+ if request.method == "POST":
+ whitelist.delete()
+ messages.success(request, "L'accés gracieux a été supprimé")
+ return redirect(reverse(
+ 'users:profil',
+ kwargs={'userid': str(whitelist.user.id)}
+ ))
+ return form(
+ {'objet': whitelist, 'objet_name': 'whitelist'},
+ 'users/delete.html',
+ request
+ )
+
@login_required
@can_create(School)
def add_school(request):
|