From 5251ec263995dc82bcc3c7932d588636142a4bfb Mon Sep 17 00:00:00 2001 From: altf4arnold Date: Fri, 23 Feb 2024 18:31:25 +0100 Subject: [PATCH] More complex --- tldtest/settings.py | 3 ++- tldtest/templates/base.html | 12 ++++++++++++ tldtest/templates/{index.html => home.html} | 1 + tldtest/views.py | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tldtest/templates/base.html rename tldtest/templates/{index.html => home.html} (67%) diff --git a/tldtest/settings.py b/tldtest/settings.py index b36936b..8463465 100644 --- a/tldtest/settings.py +++ b/tldtest/settings.py @@ -39,6 +39,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'admin_extra_buttons', 'tldtester.apps.TldtesterConfig', + 'tldtest', ] MIDDLEWARE = [ @@ -56,7 +57,7 @@ ROOT_URLCONF = 'tldtest.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - "DIRS": [], + "DIRS": [BASE_DIR / "templates"], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/tldtest/templates/base.html b/tldtest/templates/base.html new file mode 100644 index 0000000..d61be45 --- /dev/null +++ b/tldtest/templates/base.html @@ -0,0 +1,12 @@ +{% load static %} + + + + + {% block title %}TLD Tester{% endblock %} + + +{% block content %} +{% endblock content %} + + \ No newline at end of file diff --git a/tldtest/templates/index.html b/tldtest/templates/home.html similarity index 67% rename from tldtest/templates/index.html rename to tldtest/templates/home.html index 819c632..1247810 100644 --- a/tldtest/templates/index.html +++ b/tldtest/templates/home.html @@ -1,3 +1,4 @@ +{% extends "base.html" %} {% block content %} Hello World {% endblock content %} diff --git a/tldtest/views.py b/tldtest/views.py index 8959dc2..6a72511 100644 --- a/tldtest/views.py +++ b/tldtest/views.py @@ -3,8 +3,10 @@ from django.views.generic import TemplateView class Index(TemplateView): - template_name = 'index.html' + template_name = 'home.html' +def home(request): + return render(request, 'home.html') """ def handler404(request):