From 4049582f1e574f4d6d5754f2bfb37da6e94ee42a Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Thu, 8 Aug 2019 15:11:46 +0200 Subject: [PATCH] Move adhesion to admin --- users/templates/users/aff_adhesion.html | 46 ------------------- users/templates/users/index_adhesion.html | 39 ---------------- users/templates/users/sidebar.html | 4 -- users/urls.py | 4 -- users/views.py | 56 ----------------------- 5 files changed, 149 deletions(-) delete mode 100644 users/templates/users/aff_adhesion.html delete mode 100644 users/templates/users/index_adhesion.html diff --git a/users/templates/users/aff_adhesion.html b/users/templates/users/aff_adhesion.html deleted file mode 100644 index ac4f627..0000000 --- a/users/templates/users/aff_adhesion.html +++ /dev/null @@ -1,46 +0,0 @@ -{% comment %} -Re2o est un logiciel d'administration développé initiallement au rezometz. Il -se veut agnostique au réseau considéré, de manière à être installable en -quelques clics. - -Copyright © 2017 Gabriel Détraz -Copyright © 2017 Goulven Kermarec -Copyright © 2017 Augustin Lemesle - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -{% endcomment %} - - - - - - - - - - {% for adhesion in adhesion_list %} - - - - - - {% endfor %} -
Année débutAnnée fin
{{ adhesion.annee_debut }}{{ adhesion.annee_fin }} - {% if is_bureau %} - {% include 'buttons/edit.html' with href='users:edit-adhesion' id=adhesion.id %} - {% include 'buttons/suppr.html' with href='users:del-adhesion' id=adhesion.id %} - {% endif %} - {% include 'buttons/history.html' with href='users:history' name='adhesion' id=adhesion.id %} -
diff --git a/users/templates/users/index_adhesion.html b/users/templates/users/index_adhesion.html deleted file mode 100644 index 876730e..0000000 --- a/users/templates/users/index_adhesion.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "users/sidebar.html" %} -{% comment %} -Re2o est un logiciel d'administration développé initiallement au rezometz. Il -se veut agnostique au réseau considéré, de manière à être installable en -quelques clics. - -Copyright © 2017 Gabriel Détraz -Copyright © 2017 Goulven Kermarec -Copyright © 2017 Augustin Lemesle - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -{% endcomment %} - -{% load bootstrap3 %} - -{% block title %}Adhesion{% endblock %} - -{% block content %} -

Liste des adhesion

- {% if is_bureau %} - Ajouter une adhesion - {% endif %} - {% include "users/aff_adhesion.html" with adhesion_list=adhesion_list %} -
-
-
-{% endblock %} diff --git a/users/templates/users/sidebar.html b/users/templates/users/sidebar.html index 6290d40..f72842c 100644 --- a/users/templates/users/sidebar.html +++ b/users/templates/users/sidebar.html @@ -40,10 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc., Adhérents - - - Adhesions - Clef diff --git a/users/urls.py b/users/urls.py index bcdf665..22613b4 100644 --- a/users/urls.py +++ b/users/urls.py @@ -16,10 +16,6 @@ urlpatterns = [ url(r'^mon_profil/$', views.mon_profil, name='mon-profil'), url(r'^index_clef/$', views.index_clef, name='index-clef'), url(r'^history/(?Pclef)/(?P[0-9]+)$', views.history, name='history'), - url(r'^add_adhesion/$', views.add_adhesion, name='add-adhesion'), - url(r'^edit_adhesion/(?P[0-9]+)$', views.edit_adhesion, name='edit-adhesion'), - url(r'^del_adhesion/(?P[0-9]+)$', views.del_adhesion, name='del-adhesion'), - url(r'^index_adhesion/$', views.index_adhesion, name='index-adhesion'), url(r'^history/(?Padhesion)/(?P[0-9]+)$', views.history, name='history'), url(r'^process/(?P[a-z0-9]{32})/$', views.process, name='process'), url(r'^history/(?Puser)/(?P[0-9]+)$', views.history, name='history'), diff --git a/users/views.py b/users/views.py index 04e14d4..1447476 100644 --- a/users/views.py +++ b/users/views.py @@ -135,62 +135,6 @@ def index_clef(request): return render(request, 'users/index_clef.html', {'clef_list': clef_list}) -@login_required -@permission_required('bureau') -def add_adhesion(request): - adhesion = AdhesionForm(request.POST or None) - if adhesion.is_valid(): - with transaction.atomic(), reversion.create_revision(): - adhesion.save() - reversion.set_user(request.user) - reversion.set_comment("Création") - messages.success(request, "L'adhesion a été ajouté") - return redirect("/users/index_adhesion/") - return form({'userform': adhesion}, 'users/user.html', request) - - -@login_required -@permission_required('bureau') -def edit_adhesion(request, adhesionid): - try: - adhesion_instance = Adhesion.objects.get(pk=adhesionid) - except Adhesion.DoesNotExist: - messages.error(request, u"Entrée inexistante") - return redirect("/users/index_adhesion/") - adhesion = AdhesionForm(request.POST or None, instance=adhesion_instance) - if adhesion.is_valid(): - with transaction.atomic(), reversion.create_revision(): - adhesion.save() - reversion.set_user(request.user) - reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in adhesion.changed_data)) - messages.success(request, "Adhesion modifiée") - return redirect("/users/index_adhesion/") - return form({'userform': adhesion}, 'users/user.html', request) - - -@login_required -@permission_required('bureau') -def del_adhesion(request, adhesionid): - try: - adhesion_instance = Adhesion.objects.get(pk=adhesionid) - except Adhesion.DoesNotExist: - messages.error(request, u"Entrée inexistante") - return redirect("/users/index_adhesion/") - if request.method == "POST": - with transaction.atomic(), reversion.create_revision(): - adhesion_instance.delete() - reversion.set_user(request.user) - messages.success(request, "La adhesion a été détruit") - return redirect("/users/index_adhesion") - return form({'objet': adhesion_instance, 'objet_name': 'adhesion'}, 'users/delete.html', request) - - -@login_required -def index_adhesion(request): - adhesion_list = Adhesion.objects.all() - return render(request, 'users/index_adhesion.html', {'adhesion_list': adhesion_list}) - - @login_required @permission_required('perm') def index(request):