From f253eb82624c454150771efb46b6d34595eb6183 Mon Sep 17 00:00:00 2001 From: Patrick Canterino Date: Sun, 23 Jan 2022 14:44:35 +0100 Subject: [PATCH] Use template inheritance --- notes/templates/note_base.html | 14 ++++++++++++++ notes/templates/note_detail.html | 15 ++++----------- notes/templates/note_list.html | 15 ++++----------- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 notes/templates/note_base.html diff --git a/notes/templates/note_base.html b/notes/templates/note_base.html new file mode 100644 index 0000000..93f3dc7 --- /dev/null +++ b/notes/templates/note_base.html @@ -0,0 +1,14 @@ +{% load markdownify %} + + + + + {% block title %}{% endblock %} + + + + + +{% block content %}{% endblock %} + + \ No newline at end of file diff --git a/notes/templates/note_detail.html b/notes/templates/note_detail.html index 0862956..1fdfae9 100644 --- a/notes/templates/note_detail.html +++ b/notes/templates/note_detail.html @@ -1,19 +1,12 @@ +{% extends "note_base.html" %} {% load markdownify %} - - - - {{ note.title }} - - - - +{% block title %}{{ note.title }}{% endblock %} +{% block content %}

{{ note.title }}

{{ note.content|linebreaksbr|markdownify }}

Date: {{ note.created_at|date:"Y-m-d H:i" }}

- - - +{% endblock %} \ No newline at end of file diff --git a/notes/templates/note_list.html b/notes/templates/note_list.html index fb2da33..9f1554c 100644 --- a/notes/templates/note_list.html +++ b/notes/templates/note_list.html @@ -1,14 +1,9 @@ +{% extends "note_base.html" %} {% load markdownify %} - - - - Notes - - - - +{% block title %}Notes{% endblock %} +{% block content %}

Notes

{% for note in notes %}

{{ note.title }}

@@ -21,6 +16,4 @@ {% endfor %}

Number of notes: {{ notes_count }}

- - - +{% endblock %} \ No newline at end of file -- 2.34.1