From 6e7b02a2e1f4a0b788c207c8c882265134c18761 Mon Sep 17 00:00:00 2001 From: Calum Andrew Morrell Date: Sun, 9 Nov 2025 12:45:01 +0000 Subject: [PATCH 1/3] Created dashboard app. --- dashboard/__init__.py | 0 dashboard/admin.py | 3 +++ dashboard/apps.py | 6 ++++++ dashboard/migrations/__init__.py | 0 dashboard/models.py | 3 +++ dashboard/tests.py | 3 +++ dashboard/views.py | 3 +++ 7 files changed, 18 insertions(+) create mode 100644 dashboard/__init__.py create mode 100644 dashboard/admin.py create mode 100644 dashboard/apps.py create mode 100644 dashboard/migrations/__init__.py create mode 100644 dashboard/models.py create mode 100644 dashboard/tests.py create mode 100644 dashboard/views.py diff --git a/dashboard/__init__.py b/dashboard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/admin.py b/dashboard/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/dashboard/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/dashboard/apps.py b/dashboard/apps.py new file mode 100644 index 0000000..db15b45 --- /dev/null +++ b/dashboard/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DashboardConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "dashboard" diff --git a/dashboard/migrations/__init__.py b/dashboard/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/models.py b/dashboard/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/dashboard/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/dashboard/tests.py b/dashboard/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/dashboard/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/dashboard/views.py b/dashboard/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/dashboard/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. From 447edf45cbe9ecd190e07158a4fe3dd34d3a2c9a Mon Sep 17 00:00:00 2001 From: Calum Andrew Morrell Date: Sun, 9 Nov 2025 12:53:32 +0000 Subject: [PATCH 2/3] Added template and template view for dashboard. --- dashboard/templates/dashboard/dashboard.html | 5 +++++ dashboard/urls.py | 9 +++++++++ dashboard/views.py | 9 +++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 dashboard/templates/dashboard/dashboard.html create mode 100644 dashboard/urls.py diff --git a/dashboard/templates/dashboard/dashboard.html b/dashboard/templates/dashboard/dashboard.html new file mode 100644 index 0000000..e1654ea --- /dev/null +++ b/dashboard/templates/dashboard/dashboard.html @@ -0,0 +1,5 @@ +{% extends 'base.html' %} + +{% block content %} +

Dashboard

+{% endblock %} diff --git a/dashboard/urls.py b/dashboard/urls.py new file mode 100644 index 0000000..1c8bae3 --- /dev/null +++ b/dashboard/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from .views import Dashboard + +app_name = "dashboard" + +urlpatterns = [ + path("", Dashboard.as_view(), name="dashboard"), +] diff --git a/dashboard/views.py b/dashboard/views.py index 91ea44a..65157b1 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -1,3 +1,8 @@ -from django.shortcuts import render +from django.contrib.auth.decorators import login_required +from django.utils.decorators import method_decorator +from django.views.generic import TemplateView -# Create your views here. + +@method_decorator(login_required, name="dispatch") +class Dashboard(TemplateView): + template_name = "dashboard/dashboard.html" From b07b223729850cdf45eee3ec7faab04dce92f4a5 Mon Sep 17 00:00:00 2001 From: Calum Andrew Morrell Date: Sun, 9 Nov 2025 12:53:45 +0000 Subject: [PATCH 3/3] Linked dashboard into project. --- config/settings.py | 2 ++ config/urls.py | 1 + 2 files changed, 3 insertions(+) diff --git a/config/settings.py b/config/settings.py index 1c382c2..68ca2c4 100644 --- a/config/settings.py +++ b/config/settings.py @@ -44,6 +44,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "core", + "dashboard", ] MIDDLEWARE = [ @@ -131,6 +132,7 @@ STATIC_ROOT = BASE_DIR / "static" # User model and authentication AUTH_USER_MODEL = "accounts.User" +LOGIN_REDIRECT_URL = "dashboard:dashboard" LOGOUT_REDIRECT_URL = "core:homepage" diff --git a/config/urls.py b/config/urls.py index d5df533..222ea61 100644 --- a/config/urls.py +++ b/config/urls.py @@ -22,4 +22,5 @@ urlpatterns = [ path("admin/", admin.site.urls), path("", include("core.urls", namespace="core")), path("accounts/", include("accounts.urls")), + path("dashboard/", include("dashboard.urls", namespace="dashboard")), ]