From: Patrick Canterino Date: Sun, 23 Jan 2022 13:44:35 +0000 (+0100) Subject: Use template inheritance X-Git-Url: https://git.p6c8.net/pcdenotes.git/commitdiff_plain/f253eb82624c454150771efb46b6d34595eb6183?hp=5180f5cea6192febac98268fbf579e7031cf2e22 Use template inheritance --- 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