forked from DGNum/gestioCOF
Version 1.0 remise à zéro comptes COF
This commit is contained in:
parent
319db68655
commit
ba74779f95
3 changed files with 20 additions and 9 deletions
|
@ -114,6 +114,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{% url "utile_cof" %}">Liens utiles du COF</a></li>
|
<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 "utile_bda" %}">Liens utiles BdA</a></li>
|
||||||
|
<li><a href="{% url "reset_comptes" %}">Remise à zéro adhérents COF</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h2>Remise à zéro des membres COF</h2>
|
<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>
|
<p> Voulez-vous vraiment remettre à zéro le statut COF de tous les membres actuels ? </p>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<input type='submit' value="Confirmer">{% csrf_token %}
|
<input type='submit' value="Confirmer">{% csrf_token %}
|
||||||
</form>
|
</form>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -78,18 +78,24 @@ class HomeView(LoginRequiredMixin, TemplateView):
|
||||||
context["now"] = timezone.now()
|
context["now"] = timezone.now()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
class ResetComptes(LoginRequiredMixin, TemplateView):
|
class ResetComptes(BuroRequiredMixin, TemplateView):
|
||||||
template_name = "gestioncof/reset_comptes.html"
|
template_name = "gestioncof/reset_comptes.html"
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
for profile in CofProfile.objects.all():
|
CofProfile.objects.update(
|
||||||
profile.is_cof = False
|
is_cof = False,
|
||||||
profile.mailing_cof = False
|
mailing_cof=False,
|
||||||
profile.mailing_bda = False
|
mailing_bda=False,
|
||||||
profile.mailing_bda_revent = False
|
mailing_bda_revente=False,
|
||||||
profile.mailing_unernestaparis = False
|
mailing_unernestaparis=False)
|
||||||
profile.save()
|
context = self.get_context_data()
|
||||||
return super().get(request)
|
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):
|
def login(request):
|
||||||
|
|
Loading…
Reference in a new issue