diff --git a/gestioncof/cms/models.py b/gestioncof/cms/models.py index c0d07aad..1e1aad43 100644 --- a/gestioncof/cms/models.py +++ b/gestioncof/cms/models.py @@ -49,6 +49,7 @@ class COFRootPage(RoutablePageMixin, Page, COFActuIndexMixin): return sympa_captcha_form_view(request) + # Block iframe class IFrameBlock(blocks.StructBlock): url = blocks.URLBlock("Adresse de la page") diff --git a/gestioncof/cms/views.py b/gestioncof/cms/views.py index 41bf0135..8ea7c625 100644 --- a/gestioncof/cms/views.py +++ b/gestioncof/cms/views.py @@ -1,12 +1,14 @@ +import re + from django import forms -from django.shortcuts import render, redirect +from django.shortcuts import render from django.utils.translation import gettext as _ -import re def raw_calendar_view(request, year, month): return render(request, "cofcms/calendar_raw.html", {"month": month, "year": year}) + class CaptchaForm(forms.Form): answer = forms.CharField(label="RĂ©ponse", max_length=32) @@ -17,13 +19,17 @@ class CaptchaForm(forms.Form): return value + def sympa_captcha_form_view(request): if request.method == "POST": form = CaptchaForm(request.POST) if form.is_valid(): - return render(request, "cofcms/sympa.html", - {"redirect": "https://lists.ens.fr/wws/lists/"}) + return render( + request, + "cofcms/sympa.html", + {"redirect": "https://lists.ens.fr/wws/lists/"}, + ) else: form = CaptchaForm() - + return render(request, "cofcms/sympa.html", {"form": form})