created app to manage the homepage and standard templates

dev
Calum Andrew Morrell 2025-11-05 15:58:52 +00:00
parent 1ac66b4697
commit d77cbd0d8d
14 changed files with 115 additions and 0 deletions

0
core/__init__.py Normal file
View File

3
core/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
core/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "core"

View File

3
core/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

27
core/templates/base.html Normal file
View File

@ -0,0 +1,27 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>
{% block title %}The Dazed Gerbil ROCKS{% endblock %}
</title>
{% block styles %}{% endblock %}
</head>
<body>
{% block page %}
{% block usernav %}
{% include 'usernav.html' %}
{% endblock %}
{% block header %}
{% include 'header.html' %}
{% endblock %}
{% block sitenav %}{% endblock %}
{% block content %}{% endblock %}
{% block footer %}
{% include 'footer.html' %}
{% endblock %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,4 @@
<footer>
<p>&copy; The Dazed Gerbil 2020 to {% now "Y" %}</p>
</footer>

View File

@ -0,0 +1,4 @@
<header>
<h1><a href="{% url 'core:homepage' %}">The Dazed Gerbil ROCKS</a></h1>
</header>

View File

@ -0,0 +1,15 @@
<nav>
<hr />
<ul>
{% if page_obj.has_previous %}
<li><a href="?page=1">&laquo; first</a></li>
<li><a href="?page={{ page_obj.previous_page_number }}">previous</a></li>
{% endif %} {% for page in page_obj.paginator.page_range %}
<li><a href="?page={{ page }}">{{ page }}</a></li>
{% endfor %} {% if page_obj.has_next %}
<li><a href="?page={{ page_obj.next_page_number }}">next</a></li>
<li><a href="?page={{ page_obj.paginator.num_pages }}">last &raquo;</a></li>
{% endif %}
</ul>
</nav>

View File

@ -0,0 +1,31 @@
<div>
<ul>
{% if request.user.is_authenticated %}
<span>Nice to see you again {{ request.user }}!</span>
<li>
<a href="{% url 'dashboard:dashboard' %}">Dashboard</a>
</li>
{# <li><a href="{% url 'display_profile' %}">Account profile</a></li> #}
<li>
<form method="post" action="{% url 'logout' %}" style="display: inline;">
{% csrf_token %}
<button type="submit"
style="background: none;
border: none;
cursor: pointer;
padding: 0;
text-decoration: underline">Logout</button>
</form>
</li>
{% else %}
{# <li><a href="{% url 'django_registration_register' %}">Sign up</a></li> #}
<li>
<a href="{% url 'login' %}">Login</a>
</li>
<li>
<a href="{% url 'password_reset' %}">Forgotten password?</a>
</li>
{% endif %}
</ul>
</div>

3
core/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

9
core/urls.py Normal file
View File

@ -0,0 +1,9 @@
from django.urls import path
from .views import Homepage
app_name = "core"
urlpatterns = [
path("", Homepage.as_view(), name="homepage"),
]

5
core/views.py Normal file
View File

@ -0,0 +1,5 @@
from django.views.generic import TemplateView
class Homepage(TemplateView):
template_name = "core/homepage.html"