Version 1.1 remise à zéro comptes COF

This commit is contained in:
Alseidon 2020-12-09 23:00:00 +01:00
parent ba74779f95
commit c100f2fc8d
2 changed files with 8 additions and 10 deletions

View file

@ -3,11 +3,12 @@
{% block realcontent %}
<h2>Remise à zéro des membres COF</h2>
{% if is_done%}
Order 66 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">{% csrf_token %}
<input type='submit' value="Confirmer" class="btn btn-primary pull-right">{% csrf_token %}
</form>
{% endif %}
{% endblock %}

View file

@ -82,20 +82,17 @@ 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 = self.get_context_data()
return render(request, self.template_name, context)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
if self.request.method == 'POST':
context = super().get_context_data()
context['is_done'] = True
return context
context['nb_adherents'] = nb_adherents
return render(request, self.template_name, context)
def login(request):