]> git.p6c8.net - pcdenotes.git/commitdiff
Use template inheritance
authorPatrick Canterino <patrick@patrick-canterino.de>
Sun, 23 Jan 2022 13:44:35 +0000 (14:44 +0100)
committerPatrick Canterino <patrick@patrick-canterino.de>
Sun, 23 Jan 2022 13:44:35 +0000 (14:44 +0100)
notes/templates/note_base.html [new file with mode: 0644]
notes/templates/note_detail.html
notes/templates/note_list.html

diff --git a/notes/templates/note_base.html b/notes/templates/note_base.html
new file mode 100644 (file)
index 0000000..93f3dc7
--- /dev/null
@@ -0,0 +1,14 @@
+{% load markdownify %}
+<!DOCTYPE html>
+
+<html lang="en">
+<head>
+  <title>{% block title %}{% endblock %}</title>
+  <meta charset="UTF-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+
+{% block content %}{% endblock %}
+</body>
+</html>
\ No newline at end of file
index 086295606274241bf60a4154b2abcd8810591e42..1fdfae99d044468a6c2a2bca6610bad72ff6f975 100644 (file)
@@ -1,19 +1,12 @@
+{% extends "note_base.html" %}
 {% load markdownify %}
-<!DOCTYPE html>
 
-<html lang="de">
-<head>
-  <title>{{ note.title }}</title>
-  <meta charset="UTF-8" />
-  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-</head>
-<body>
+{% block title %}{{ note.title }}{% endblock %}
 
+{% block content %}
   <h1>{{ note.title }}</h1>
 
   <div>{{ note.content|linebreaksbr|markdownify }}</div>
   
   <p>Date: {{ note.created_at|date:"Y-m-d H:i" }}</p>
-
-</body>
-</html>
+{% endblock %}
\ No newline at end of file
index fb2da3323eeb119467cf1c05c1706a8440039364..9f1554c1f2446c77b9fe9e7461858a5aedf95de4 100644 (file)
@@ -1,14 +1,9 @@
+{% extends "note_base.html" %}
 {% load markdownify %}
-<!DOCTYPE html>
 
-<html lang="de">
-<head>
-  <title>Notes</title>
-  <meta charset="UTF-8" />
-  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-</head>
-<body>
+{% block title %}Notes{% endblock %}
 
+{% block content %}
     <h1>Notes</h1>
     {% for note in notes %}
     <h2>{{ note.title }}</h2>
@@ -21,6 +16,4 @@
     {% endfor %}
 
     <p>Number of notes: {{ notes_count }}</p>
-
-</body>
-</html>
+{% endblock %}
\ No newline at end of file

patrick-canterino.de