From 33290903297c76dd7e5a81bc9a7c74258944196e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 7 May 2020 14:24:50 +0100 Subject: [PATCH] Add blog page --- templates/blog/index.html | 11 +++++++++++ website/blog/__init__.py | 0 website/blog/tests.py | 9 +++++++++ website/blog/urls.py | 7 +++++++ website/blog/views.py | 5 +++++ website/settings.py | 1 + website/urls.py | 5 ++++- 7 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 templates/blog/index.html create mode 100644 website/blog/__init__.py create mode 100644 website/blog/tests.py create mode 100644 website/blog/urls.py create mode 100644 website/blog/views.py diff --git a/templates/blog/index.html b/templates/blog/index.html new file mode 100644 index 0000000..cf83b27 --- /dev/null +++ b/templates/blog/index.html @@ -0,0 +1,11 @@ +{% extends "content.html" %} + +{% load static %} + +{% block title %}Blog{% endblock %} + +{% block headerimage %}{% static "img/header.jpg" %}{% endblock %} + +{% block content %} + +{% endblock%} diff --git a/website/blog/__init__.py b/website/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/website/blog/tests.py b/website/blog/tests.py new file mode 100644 index 0000000..f6cca26 --- /dev/null +++ b/website/blog/tests.py @@ -0,0 +1,9 @@ +from django.urls import reverse + +from website.common.tests import BaseTestCase + + +class BlogListViewTestCase(BaseTestCase): + def test_accessible(self): + response = self.client.get(reverse("blog:list")) + self.assertEqual(response.status_code, 200) diff --git a/website/blog/urls.py b/website/blog/urls.py new file mode 100644 index 0000000..bdc5d1e --- /dev/null +++ b/website/blog/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +app_name = "blog" + +urlpatterns = [path("", views.BlogListView.as_view(), name="list")] diff --git a/website/blog/views.py b/website/blog/views.py new file mode 100644 index 0000000..fffe0a4 --- /dev/null +++ b/website/blog/views.py @@ -0,0 +1,5 @@ +from django.views.generic import TemplateView + + +class BlogListView(TemplateView): + template_name = "blog/index.html" diff --git a/website/settings.py b/website/settings.py index c657eaa..0e2241d 100644 --- a/website/settings.py +++ b/website/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ "debug_toolbar", "sri", "website.common", + "website.blog", ] MIDDLEWARE = [ diff --git a/website/urls.py b/website/urls.py index 124f4e9..3a9f1e3 100644 --- a/website/urls.py +++ b/website/urls.py @@ -4,7 +4,10 @@ from django.urls import include, path from website.common.urls import urlpatterns as common_urlpatterns -urlpatterns = [path("", include(common_urlpatterns))] +urlpatterns = [ + path("", include(common_urlpatterns)), + path("blog/", include("website.blog.urls")), +] if settings.DEBUG: urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))