Add blog page
This commit is contained in:
parent
0b2cd9a597
commit
3329090329
7 changed files with 37 additions and 1 deletions
11
templates/blog/index.html
Normal file
11
templates/blog/index.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "content.html" %}
|
||||||
|
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}Blog{% endblock %}
|
||||||
|
|
||||||
|
{% block headerimage %}{% static "img/header.jpg" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% endblock%}
|
0
website/blog/__init__.py
Normal file
0
website/blog/__init__.py
Normal file
9
website/blog/tests.py
Normal file
9
website/blog/tests.py
Normal file
|
@ -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)
|
7
website/blog/urls.py
Normal file
7
website/blog/urls.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
app_name = "blog"
|
||||||
|
|
||||||
|
urlpatterns = [path("", views.BlogListView.as_view(), name="list")]
|
5
website/blog/views.py
Normal file
5
website/blog/views.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
|
||||||
|
class BlogListView(TemplateView):
|
||||||
|
template_name = "blog/index.html"
|
|
@ -40,6 +40,7 @@ INSTALLED_APPS = [
|
||||||
"debug_toolbar",
|
"debug_toolbar",
|
||||||
"sri",
|
"sri",
|
||||||
"website.common",
|
"website.common",
|
||||||
|
"website.blog",
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
|
@ -4,7 +4,10 @@ from django.urls import include, path
|
||||||
|
|
||||||
from website.common.urls import urlpatterns as common_urlpatterns
|
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:
|
if settings.DEBUG:
|
||||||
urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))
|
urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))
|
||||||
|
|
Reference in a new issue