forked from DGNum/gestioCOF
Suppr captcha page, ajout block iframe
This commit is contained in:
parent
347497602c
commit
3d091f50b5
4 changed files with 75 additions and 24 deletions
|
@ -165,7 +165,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"path": "0001000100020005",
|
"path": "0001000100020005",
|
||||||
"depth": 4,
|
"depth": 4,
|
||||||
"numchild": 0,
|
"numchild": 1,
|
||||||
"title": "Cours Particuliers",
|
"title": "Cours Particuliers",
|
||||||
"slug": "cours-particuliers",
|
"slug": "cours-particuliers",
|
||||||
"content_type": [
|
"content_type": [
|
||||||
|
@ -479,6 +479,38 @@
|
||||||
"live_revision": null
|
"live_revision": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"model": "wagtailcore.page",
|
||||||
|
"pk": 26,
|
||||||
|
"fields": {
|
||||||
|
"path": "00010001000200050001",
|
||||||
|
"depth": 5,
|
||||||
|
"numchild": 0,
|
||||||
|
"title": "Demande de petit cours",
|
||||||
|
"slug": "demande-de-petit-cours",
|
||||||
|
"content_type": [
|
||||||
|
"cofcms",
|
||||||
|
"cofpage"
|
||||||
|
],
|
||||||
|
"live": true,
|
||||||
|
"has_unpublished_changes": false,
|
||||||
|
"url_path": "/global/site/cours-particuliers/demande-de-petit-cours/",
|
||||||
|
"owner": [
|
||||||
|
"root"
|
||||||
|
],
|
||||||
|
"seo_title": "",
|
||||||
|
"show_in_menus": false,
|
||||||
|
"search_description": "",
|
||||||
|
"go_live_at": null,
|
||||||
|
"expire_at": null,
|
||||||
|
"expired": false,
|
||||||
|
"locked": false,
|
||||||
|
"first_published_at": "2018-03-21T19:54:20.527Z",
|
||||||
|
"last_published_at": "2018-03-21T19:54:20.527Z",
|
||||||
|
"latest_revision_created_at": "2018-03-21T19:54:20.302Z",
|
||||||
|
"live_revision": null
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"model": "wagtailcore.collection",
|
"model": "wagtailcore.collection",
|
||||||
"pk": 3,
|
"pk": 3,
|
||||||
|
@ -747,8 +779,8 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"sort_order": 5,
|
"sort_order": 5,
|
||||||
"link_page": null,
|
"link_page": null,
|
||||||
"link_url": "/sympa/",
|
"link_url": "https://www.eleves.ens.fr",
|
||||||
"link_text": "Listes mail",
|
"link_text": "Services élèves ENS",
|
||||||
"handle": "",
|
"handle": "",
|
||||||
"url_append": "",
|
"url_append": "",
|
||||||
"allow_subnav": false,
|
"allow_subnav": false,
|
||||||
|
@ -877,8 +909,27 @@
|
||||||
"seo_title_en": null,
|
"seo_title_en": null,
|
||||||
"search_description_fr": "",
|
"search_description_fr": "",
|
||||||
"search_description_en": "",
|
"search_description_en": "",
|
||||||
"body": "[{\"id\": \"dbf9f940-51a6-43d1-89ff-1bf0648cead8\", \"value\": \"<p>Les \\u00e9l\\u00e8ves de l'ENS peuvent donner des cours particuliers. Si vous \\n\\u00eates int\\u00e9ress\\u00e9 pour en prendre, merci de faire une demande de petits \\ncours sur <a href=\\\"https://www.cof.ens.fr/news/petitscours.php\\\">cette page</a>.</p>\\n \\n \\n\\t\\n\\t<br/>\\n\\tSi vous \\u00eates \\u00e9l\\u00e8ve de l'\\u00e9cole, vous pouvez g\\u00e9rer vos petits cours sur <a href=\\\"http://www.cof.ens.fr/gestion\\\">GestioCOF</a>.\", \"type\": \"paragraph\"}]",
|
"body": "[{\"id\": \"dbf9f940-51a6-43d1-89ff-1bf0648cead8\", \"value\": \"<p>Les \\u00e9l\\u00e8ves de l'ENS peuvent donner des cours particuliers. Si vous \\n\\u00eates int\\u00e9ress\\u00e9 pour en prendre, merci de faire une demande de petits \\ncours sur <a id=\\\"26\\\" linktype=\\\"page\\\">cette page</a>.</p>\\n \\n \\n\\t\\n\\t<br/>\\n\\tSi vous \\u00eates \\u00e9l\\u00e8ve de l'\\u00e9cole, vous pouvez g\\u00e9rer vos petits cours sur <a href=\\\"http://www.cof.ens.fr/gestion\\\">GestioCOF</a>.\", \"type\": \"paragraph\"}]",
|
||||||
"body_fr": "[{\"id\": \"dbf9f940-51a6-43d1-89ff-1bf0648cead8\", \"value\": \"<p>Les \\u00e9l\\u00e8ves de l'ENS peuvent donner des cours particuliers. Si vous \\n\\u00eates int\\u00e9ress\\u00e9 pour en prendre, merci de faire une demande de petits \\ncours sur <a href=\\\"https://www.cof.ens.fr/news/petitscours.php\\\">cette page</a>.</p>\\n \\n \\n\\t\\n\\t<br/>\\n\\tSi vous \\u00eates \\u00e9l\\u00e8ve de l'\\u00e9cole, vous pouvez g\\u00e9rer vos petits cours sur <a href=\\\"http://www.cof.ens.fr/gestion\\\">GestioCOF</a>.\", \"type\": \"paragraph\"}]",
|
"body_fr": "[{\"id\": \"dbf9f940-51a6-43d1-89ff-1bf0648cead8\", \"value\": \"<p>Les \\u00e9l\\u00e8ves de l'ENS peuvent donner des cours particuliers. Si vous \\n\\u00eates int\\u00e9ress\\u00e9 pour en prendre, merci de faire une demande de petits \\ncours sur <a id=\\\"26\\\" linktype=\\\"page\\\">cette page</a>.</p>\\n \\n \\n\\t\\n\\t<br/>\\n\\tSi vous \\u00eates \\u00e9l\\u00e8ve de l'\\u00e9cole, vous pouvez g\\u00e9rer vos petits cours sur <a href=\\\"http://www.cof.ens.fr/gestion\\\">GestioCOF</a>.\", \"type\": \"paragraph\"}]",
|
||||||
|
"body_en": "[]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"model": "cofcms.cofpage",
|
||||||
|
"pk": 26,
|
||||||
|
"fields": {
|
||||||
|
"title_fr": "Demande de petit cours",
|
||||||
|
"title_en": null,
|
||||||
|
"slug_fr": "demande-de-petit-cours",
|
||||||
|
"slug_en": null,
|
||||||
|
"url_path_fr": "/global/site/cours-particuliers/demande-de-petit-cours/",
|
||||||
|
"url_path_en": "/global/site/cours-particuliers/demande-de-petit-cours/",
|
||||||
|
"seo_title_fr": null,
|
||||||
|
"seo_title_en": null,
|
||||||
|
"search_description_fr": "",
|
||||||
|
"search_description_en": "",
|
||||||
|
"body": "[{\"value\": {\"url\": \"https://www.cof.ens.fr/gestion/petitcours/demande-raw\", \"height\": \"1050\"}, \"id\": \"397ff222-6c1b-4e5c-a971-a50621dd83b3\", \"type\": \"iframe\"}]",
|
||||||
|
"body_fr": "[{\"value\": {\"url\": \"https://www.cof.ens.fr/gestion/petitcours/demande-raw\", \"height\": \"1050\"}, \"id\": \"397ff222-6c1b-4e5c-a971-a50621dd83b3\", \"type\": \"iframe\"}]",
|
||||||
"body_en": "[]"
|
"body_en": "[]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,13 +34,23 @@ class COFRootPage(Page, COFActuIndexMixin):
|
||||||
verbose_name = "Racine site du COF"
|
verbose_name = "Racine site du COF"
|
||||||
verbose_name_plural = "Racines site du COF"
|
verbose_name_plural = "Racines site du COF"
|
||||||
|
|
||||||
|
# Block iframe
|
||||||
|
class IFrameBlock(blocks.StructBlock):
|
||||||
|
url = blocks.URLBlock("Adresse de la page")
|
||||||
|
height = blocks.CharBlock("Hauteur (en pixels)")
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Page incluse (iframe, à utiliser avec précaution)"
|
||||||
|
verbose_name_plural = "Pages incluses (iframes, à utiliser avec précaution)"
|
||||||
|
template = "cofcms/iframe_block.html"
|
||||||
|
|
||||||
# Page lambda du site
|
# Page lambda du site
|
||||||
class COFPage(Page):
|
class COFPage(Page):
|
||||||
body = StreamField([
|
body = StreamField([
|
||||||
('heading', blocks.CharBlock(classname="full title")),
|
('heading', blocks.CharBlock(classname="full title")),
|
||||||
('paragraph', blocks.RichTextBlock()),
|
('paragraph', blocks.RichTextBlock()),
|
||||||
('image', ImageChooserBlock()),
|
('image', ImageChooserBlock()),
|
||||||
|
('iframe', IFrameBlock()),
|
||||||
])
|
])
|
||||||
|
|
||||||
content_panels = Page.content_panels + [
|
content_panels = Page.content_panels + [
|
||||||
|
@ -169,13 +179,8 @@ class COFDirectoryEntryPage(Page, Orderable):
|
||||||
verbose_name = "Entrée d'annuaire"
|
verbose_name = "Entrée d'annuaire"
|
||||||
verbose_name_plural = "Entrées d'annuaire"
|
verbose_name_plural = "Entrées d'annuaire"
|
||||||
|
|
||||||
# Pour le calendrier et le sympa, ne doit pas être pris par ModelTranslation
|
# Pour le calendrier, ne doit pas être pris par ModelTranslation
|
||||||
class COFUtilPage(RoutablePageMixin, Page):
|
class COFUtilPage(RoutablePageMixin, Page):
|
||||||
# Protection pour le serveur des mailing listes
|
|
||||||
@route(r'^sympa/$')
|
|
||||||
def sympa(self, request):
|
|
||||||
from .views import sympa_view
|
|
||||||
return sympa_view(request)
|
|
||||||
|
|
||||||
# Mini calendrier
|
# Mini calendrier
|
||||||
@route(r'^calendar/(\d+)/(\d+)/$')
|
@route(r'^calendar/(\d+)/(\d+)/$')
|
||||||
|
|
|
@ -11,15 +11,19 @@
|
||||||
{% for block in page.body %}
|
{% for block in page.body %}
|
||||||
{% if block.block_type == "heading" %}
|
{% if block.block_type == "heading" %}
|
||||||
<h2>{{ block.value }}</h2>
|
<h2>{{ block.value }}</h2>
|
||||||
{% else %}{% if block.block_type == "paragraph" %}
|
{% elif block.block_type == "paragraph" %}
|
||||||
<article class="paragraph">
|
<article class="paragraph">
|
||||||
{{ block.value|safe }}
|
{{ block.value|safe }}
|
||||||
</article>
|
</article>
|
||||||
{% else %}{% if block.block_type == "image" %}
|
{% elif block.block_type == "image" %}
|
||||||
<div class="image">
|
<div class="image">
|
||||||
{% image block.value width-800 %}
|
{% image block.value width-800 %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}{% endif %}{% endif %}
|
{% elif block.block_type == "iframe" %}
|
||||||
|
<article class="paragraph">
|
||||||
|
<iframe src="{{ block.value.url }}" width="100%" height="{{ block.value.height }}px"></iframe>
|
||||||
|
</article>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,12 +4,3 @@ import re
|
||||||
|
|
||||||
def raw_calendar_view(request, year, month):
|
def raw_calendar_view(request, year, month):
|
||||||
return render(request, "cofcms/calendar_raw.html", {"month": month, "year": year})
|
return render(request, "cofcms/calendar_raw.html", {"month": month, "year": year})
|
||||||
|
|
||||||
def sympa_view(request):
|
|
||||||
erreur = None
|
|
||||||
if request.POST and "bassin" in request.POST:
|
|
||||||
if re.match(r'\s*(les|the)\s*ernests?\s*', request.POST["bassin"],
|
|
||||||
re.IGNORECASE):
|
|
||||||
return HttpResponseRedirect("https://lists.ens.fr/wws")
|
|
||||||
erreur = "Réponse invalide"
|
|
||||||
return render(request, "cofcms/sympa.html", {"erreur": erreur})
|
|
||||||
|
|
Loading…
Reference in a new issue