From 938c77707ca83b50fb509729bfed961b538d3ad6 Mon Sep 17 00:00:00 2001
From: Dorian Lesbre <dorian.lesbre@gmail.com>
Date: Sun, 27 Dec 2020 19:28:52 +0100
Subject: [PATCH] Switched to inherited templates to avoid copying
 header/footer

---
 home/templates/base.html | 44 +++++++++++++++++++++++++++++++
 home/templates/home.html | 57 +++++++---------------------------------
 home/views.py            |  2 +-
 3 files changed, 54 insertions(+), 49 deletions(-)
 create mode 100644 home/templates/base.html

diff --git a/home/templates/base.html b/home/templates/base.html
new file mode 100644
index 0000000..7075047
--- /dev/null
+++ b/home/templates/base.html
@@ -0,0 +1,44 @@
+{% load static %}
+<!doctype html>
+<html lang=fr>
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+		<title>Interludes 2021</title>
+		<meta name="description" content="Inscriptions et infos sur les interENS ludiques, édition 2021">
+		<meta name="keywords" content="Interludes ENS événement COF 2021 InterENS">
+		<!-- <link rel="icon" type="image/png" href="/static/img/favicon.png"/> -->
+
+		<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
+	</head>
+	<body>
+
+		<header>
+			<div id="header_logo">
+				<h1><a href="/">Interludes 2021</a></h1>
+			</div>
+			<div id="head_main_infos">
+				<div id="location">ENS Ulm</div>
+				<div id="date">9-11 avril 2021</div>
+			</div>
+		</header>
+
+		<nav>
+			<a href="/" class="internal">Inscriptions</a>
+			<a href="/" class="internal">Activités</a>
+			<a href="/" class="internal">FAQ</a>
+			<a href="/" class="internal">Bouton autre</a>
+		</nav>
+
+		<main>
+			{% block "content" %}
+			{% endblock %}
+		</main>
+
+		<footer>
+			logos, liens...
+		</footer>
+
+	</body>
+</html>
\ No newline at end of file
diff --git a/home/templates/home.html b/home/templates/home.html
index 85229eb..4951254 100644
--- a/home/templates/home.html
+++ b/home/templates/home.html
@@ -1,50 +1,11 @@
-{% load static %}
-<!doctype html>
-<html lang=fr>
-	<head>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, initial-scale=1.0">
+{% extends "base.html" %}
 
-		<title>Interludes 2021</title>
-		<meta name="description" content="Inscriptions et infos sur les interENS ludiques, édition 2021">
-		<meta name="keywords" content="Interludes ENS événement COF 2021 InterENS">
-		<!-- <link rel="icon" type="image/png" href="/static/img/favicon.png"/> -->
+{% block "content" %}
+	<h2>A Title</h2>
+	<p>a paragraph</p>
+	<p>another paragraph with <a href="http://www.google.com" class="external">an external link</a></p>
+	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
 
-		<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
-	</head>
-	<body>
-
-		<header>
-			<div id="header_logo">
-				<h1><a href="/">Interludes 2021</a></h1>
-			</div>
-			<div id="head_main_infos">
-				<div id="location">ENS Ulm</div>
-				<div id="date">9-11 avril 2021</div>
-			</div>
-		</header>
-
-		<nav>
-			<a href="/" class="internal">Inscriptions</a>
-			<a href="/" class="internal">Activités</a>
-			<a href="/" class="internal">FAQ</a>
-			<a href="/" class="internal">Bouton autre</a>
-		</nav>
-
-		<main>
-			<h2>A Title</h2>
-			<p>a paragraph</p>
-			<p>another paragraph with <a href="http://www.google.com" class="external">an external link</a></p>
-			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
-
-			<h2>Another title</h2>
-			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
-
-		</main>
-
-		<footer>
-			logos, liens...
-		</footer>
-
-	</body>
-</html>
\ No newline at end of file
+	<h2>Another title</h2>
+	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+{% endblock %}
diff --git a/home/views.py b/home/views.py
index 795eb43..8e9bac2 100644
--- a/home/views.py
+++ b/home/views.py
@@ -1,4 +1,4 @@
 from django.shortcuts import render
 
 def home(request):
-    return render(request, 'home.html', {})
\ No newline at end of file
+	return render(request, 'home.html', {})
-- 
GitLab