diff options
-rw-r--r-- | templates/contact.html | 9 | ||||
-rw-r--r-- | templates/index.html | 2 | ||||
-rw-r--r-- | templatetags/email.py | 24 | ||||
-rw-r--r-- | urls.py | 1 | ||||
-rw-r--r-- | views.py | 4 |
5 files changed, 39 insertions, 1 deletions
diff --git a/templates/contact.html b/templates/contact.html new file mode 100644 index 0000000..1359a16 --- /dev/null +++ b/templates/contact.html @@ -0,0 +1,9 @@ +{% extends "index.html" %} +{% load email %} + +{% block title %}Contacter – {% endblock %} + +{% block body %} + <h3>Contacter</h3> + <p>Pour contacter l’administrateur du service, envoyez un mail à l’adresse suivante :<br/>{{ email|format_email }}.</p> +{% endblock %} diff --git a/templates/index.html b/templates/index.html index 366e6f9..6597158 100644 --- a/templates/index.html +++ b/templates/index.html @@ -23,7 +23,7 @@ {% endblock %} </div> <footer> - <p>(c) 2017 – Alban Gruin<br /> + <p>(c) 2017 – Alban Gruin – <a href="{% url "contact" %}">contacter</a><br /> Design inspiré par <a href="https://bestmotherfucking.website/">https://bestmotherfucking.website/</a><br /> Les informations affichées sur ce site sont actualisées tout les jours à minuit CET. </p> diff --git a/templatetags/email.py b/templatetags/email.py new file mode 100644 index 0000000..68dbd84 --- /dev/null +++ b/templatetags/email.py @@ -0,0 +1,24 @@ +# Copyright (C) 2017 Alban Gruin +# +# celcatsanitizer is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# celcatsanitizer is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. + +from django import template + +register = template.Library() + +@register.filter +def format_email(address): + return address.replace("+", " [plus] ") \ + .replace("@", " [arobase] ") \ + .replace(".", " [point] ") @@ -18,6 +18,7 @@ from . import feeds, views urlpatterns = [ url(r"^$", views.index, name="index"), + url(r"^contact$", views.contact, name="contact"), url(r"^(?P<year_slug>[-\w]+)/$", views.mention_list, name="mentions"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/$", views.group_list, name="groups"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/$", views.timetable, name="timetable"), @@ -13,6 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. +from django.conf import settings from django.shortcuts import get_object_or_404, render from .models import Timetable, LastUpdate, Group, Course, Year @@ -65,3 +66,6 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No grouped_courses = group_courses(courses) return render(request, "timetable.html", {"group": group, "courses": grouped_courses, "last_update": last_update.date, "year": year, "week": int(week)}) + +def contact(request): + return render(request, "contact.html", {"email": settings.ADMINS[0][1]}) |