Satisfy Lord Black

This commit is contained in:
Alseidon 2021-01-07 09:19:56 +01:00
parent c100f2fc8d
commit 44b001bd3c
2 changed files with 6 additions and 6 deletions

View file

@ -82,9 +82,7 @@ urlpatterns = [
# Misc # Misc
# ----- # -----
path("", views.HomeView.as_view(), name="home"), path("", views.HomeView.as_view(), name="home"),
path("reset_comptes/", views.ResetComptes.as_view(), name="reset_comptes"), path("reset_comptes/", views.ResetComptes.as_view(), name="reset_comptes"),
path( path(
"user/autocomplete", "user/autocomplete",
views.UserAutocompleteView.as_view(), views.UserAutocompleteView.as_view(),

View file

@ -78,20 +78,22 @@ class HomeView(LoginRequiredMixin, TemplateView):
context["now"] = timezone.now() context["now"] = timezone.now()
return context return context
class ResetComptes(BuroRequiredMixin, 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):
nb_adherents = CofProfile.objects.filter(is_cof=True).count() nb_adherents = CofProfile.objects.filter(is_cof=True).count()
CofProfile.objects.update( CofProfile.objects.update(
is_cof = False, is_cof=False,
mailing_cof=False, mailing_cof=False,
mailing_bda=False, mailing_bda=False,
mailing_bda_revente=False, mailing_bda_revente=False,
mailing_unernestaparis=False) mailing_unernestaparis=False,
)
context = super().get_context_data() context = super().get_context_data()
context['is_done'] = True context["is_done"] = True
context['nb_adherents'] = nb_adherents context["nb_adherents"] = nb_adherents
return render(request, self.template_name, context) return render(request, self.template_name, context)