8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Ajout d'un bouton pour supprimer les accés gracieux

This commit is contained in:
Grizzly 2018-06-17 13:12:12 +00:00
parent 4252f84398
commit 3e244b8ba9
3 changed files with 23 additions and 0 deletions

View file

@ -47,6 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ whitelist.date_start }}</td> <td>{{ whitelist.date_start }}</td>
<td>{{ whitelist.date_end }}</td> <td>{{ whitelist.date_end }}</td>
<td class="text-right"> <td class="text-right">
{% can_delete whitelist %}
{% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
{% acl_end %}
{% can_edit whitelist %} {% can_edit whitelist %}
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %} {% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
{% acl_end %} {% acl_end %}

View file

@ -62,6 +62,9 @@ urlpatterns = [
url(r'^edit_whitelist/(?P<whitelistid>[0-9]+)$', url(r'^edit_whitelist/(?P<whitelistid>[0-9]+)$',
views.edit_whitelist, views.edit_whitelist,
name='edit-whitelist'), name='edit-whitelist'),
url(r'^del_whitelist/(?P<whitelistid>[0-9]+)$',
views.del_whitelist,
name='del-whitelist'),
url(r'^add_school/$', views.add_school, name='add-school'), url(r'^add_school/$', views.add_school, name='add-school'),
url(r'^edit_school/(?P<schoolid>[0-9]+)$', url(r'^edit_school/(?P<schoolid>[0-9]+)$',
views.edit_school, views.edit_school,

View file

@ -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 @login_required
@can_create(School) @can_create(School)
def add_school(request): def add_school(request):