aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-10-31 13:10:18 +0100
committerAlban Gruin2017-10-31 13:10:18 +0100
commit3f610831227e7def4b74651747d5625c9a009311 (patch)
tree55b5deea6f47e6e165aae6580ee0c7ac32a182ec
parent55ad46fe32ce8122d884dda4eb498e20e39622ad (diff)
Création d’une flatpage spécifique à la page « à propos »
Ajout d’un processeur de contexte pour afficher la version de CS en bas de page.
-rw-r--r--templates/flatpages/about.html6
-rw-r--r--templates/index.html3
-rw-r--r--views.py5
3 files changed, 13 insertions, 1 deletions
diff --git a/templates/flatpages/about.html b/templates/flatpages/about.html
new file mode 100644
index 0000000..3df7c53
--- /dev/null
+++ b/templates/flatpages/about.html
@@ -0,0 +1,6 @@
+{% extends "flatpages/default.html" %}
+
+{% block body %}
+ <h3>{{ flatpage.title }} &ndash; celcatsanitizer {{ celcatsanitizer_version }}</h3>
+ {{ flatpage.content }}
+{% endblock %}
diff --git a/templates/index.html b/templates/index.html
index abaf5f1..1ea6e53 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -24,7 +24,8 @@
{% endblock %}
</div>
<footer>
- <p>(c) 2017 &ndash; Alban Gruin &ndash; <a href="{% url "django.contrib.flatpages.views.flatpage" url="contact/" %}">contacter</a> &ndash; <a href="{% url "django.contrib.flatpages.views.flatpage" url="a-propos/" %}">à propos</a><br />
+ <p>(c) 2017 &ndash; Alban Gruin &ndash; <a href="{% url "django.contrib.flatpages.views.flatpage" url="contact/" %}">contacter</a> &ndash;
+ celcatsanitizer {{ celcatsanitizer_version }} &ndash; <a href="{% url "django.contrib.flatpages.views.flatpage" url="a-propos/" %}">à propos</a><br />
Design inspiré par <a href="https://bestmotherfucking.website/">https://bestmotherfucking.website/</a></p>
</footer>
</body>
diff --git a/views.py b/views.py
index 384fdd0..c0c63cb 100644
--- a/views.py
+++ b/views.py
@@ -23,6 +23,8 @@ from django.shortcuts import get_object_or_404, render
from .models import Timetable, Group, Course, Year
from .utils import get_current_week, get_current_or_next_week, get_week, group_courses
+import edt
+
def index(request):
years = Year.objects.order_by("name")
return render(request, "index.html", {"elements": years})
@@ -102,3 +104,6 @@ def calendars(request, year_slug, timetable_slug, group_slug):
.order_by("length")
return render(request, "calendars.html", {"group": group, "groups": groups})
+
+def ctx_processor(request):
+ return {"celcatsanitizer_version": edt.VERSION}