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

Merge branch 'rm_whitlist' into 'master'

Rm whitlist

See merge request federez/re2o!175
This commit is contained in:
chirac 2018-06-19 14:34:17 +02:00
commit 998d093cac
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):