Version 1.0 remise à zéro comptes COF

This commit is contained in:
Alseidon 2020-12-09 22:40:32 +01:00
parent 319db68655
commit ba74779f95
3 changed files with 20 additions and 9 deletions

View file

@ -114,6 +114,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>

View file

@ -2,8 +2,12 @@
{% block realcontent %}
<h2>Remise à zéro des membres COF</h2>
{% if is_done%}
Order 66 done
{% else%}
<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 %}
</form>
{% endif %}
{% endblock %}

View file

@ -78,18 +78,24 @@ class HomeView(LoginRequiredMixin, TemplateView):
context["now"] = timezone.now()
return context
class ResetComptes(LoginRequiredMixin, TemplateView):
class ResetComptes(BuroRequiredMixin, TemplateView):
template_name = "gestioncof/reset_comptes.html"
def post(self, request):
for profile in CofProfile.objects.all():
profile.is_cof = False
profile.mailing_cof = False
profile.mailing_bda = False
profile.mailing_bda_revent = False
profile.mailing_unernestaparis = False
profile.save()
return super().get(request)
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['is_done'] = True
return context
def login(request):