Merge branch 'newbie' into 'master'
Reset comptes COF See merge request klub-dev-ens/gestioCOF!479
This commit is contained in:
commit
33319cfe76
4 changed files with 34 additions and 0 deletions
|
@ -115,6 +115,7 @@
|
|||
<ul>
|
||||
<li><a href="{% url "utile_cof" %}">Liens utiles du COF</a></li>
|
||||
<li><a href="{% url "utile_bda" %}">Liens utiles BdA</a></li>
|
||||
<li><a href="{% url "reset_comptes" %}">Remise à zéro adhérents COF</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
14
gestioncof/templates/gestioncof/reset_comptes.html
Normal file
14
gestioncof/templates/gestioncof/reset_comptes.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% extends "base_title.html" %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>Remise à zéro des membres COF</h2>
|
||||
{% if is_done%}
|
||||
<p> {{nb_adherents}} compte{{ nb_adherents|pluralize }} désinscrit{{ nb_adherents|pluralize }} du COF.</p>
|
||||
{% else%}
|
||||
<div class="alert alert-danger"> ATTENTION : Cette action est irréversible. </div>
|
||||
<p> Voulez-vous vraiment remettre à zéro le statut COF de tous les membres actuels ?</p>
|
||||
<form action="" method="POST">
|
||||
<input type='submit' value="Confirmer" class="btn btn-primary pull-right">{% csrf_token %}
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -82,6 +82,7 @@ urlpatterns = [
|
|||
# Misc
|
||||
# -----
|
||||
path("", views.HomeView.as_view(), name="home"),
|
||||
path("reset_comptes/", views.ResetComptes.as_view(), name="reset_comptes"),
|
||||
path(
|
||||
"user/autocomplete",
|
||||
views.UserAutocompleteView.as_view(),
|
||||
|
|
|
@ -79,6 +79,24 @@ class HomeView(LoginRequiredMixin, TemplateView):
|
|||
return context
|
||||
|
||||
|
||||
class ResetComptes(BuroRequiredMixin, TemplateView):
|
||||
template_name = "gestioncof/reset_comptes.html"
|
||||
|
||||
def post(self, request):
|
||||
nb_adherents = CofProfile.objects.filter(is_cof=True).count()
|
||||
CofProfile.objects.update(
|
||||
is_cof=False,
|
||||
mailing_cof=False,
|
||||
mailing_bda=False,
|
||||
mailing_bda_revente=False,
|
||||
mailing_unernestaparis=False,
|
||||
)
|
||||
context = super().get_context_data()
|
||||
context["is_done"] = True
|
||||
context["nb_adherents"] = nb_adherents
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
def login(request):
|
||||
if request.user.is_authenticated:
|
||||
return redirect("home")
|
||||
|
|
Loading…
Reference in a new issue