From 130d6a1af2a751e7201f59b5cea11e70d47ae957 Mon Sep 17 00:00:00 2001 From: TheJoeCoder <joe@radialbog9.uk> Date: Wed, 6 Nov 2024 21:18:00 +0000 Subject: [PATCH] Add app --- app/__init__.py | 0 app/admin.py | 3 +++ app/apps.py | 6 ++++++ app/migrations/__init__.py | 0 app/models.py | 3 +++ app/tests.py | 3 +++ app/urls.py | 9 +++++++++ app/views.py | 7 +++++++ attendio/settings.py | 3 ++- attendio/urls.py | 1 + templates/app/base.html | 7 ++----- templates/app/home.html | 4 ++-- templates/pub/index.html | 2 +- 13 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 app/__init__.py create mode 100644 app/admin.py create mode 100644 app/apps.py create mode 100644 app/migrations/__init__.py create mode 100644 app/models.py create mode 100644 app/tests.py create mode 100644 app/urls.py create mode 100644 app/views.py diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/admin.py b/app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/app/apps.py b/app/apps.py new file mode 100644 index 0000000..ed327d2 --- /dev/null +++ b/app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'app' diff --git a/app/migrations/__init__.py b/app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/app/tests.py b/app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/app/urls.py b/app/urls.py new file mode 100644 index 0000000..37899e7 --- /dev/null +++ b/app/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from app import views + +app_name = "app" + +urlpatterns = [ + path("", views.home, name="home"), +] \ No newline at end of file diff --git a/app/views.py b/app/views.py new file mode 100644 index 0000000..e6ed2ca --- /dev/null +++ b/app/views.py @@ -0,0 +1,7 @@ +from allauth.account.decorators import verified_email_required +from django.shortcuts import render + +# Create your views here. +@verified_email_required +def home(request): + return render(request, "app/home.html") \ No newline at end of file diff --git a/attendio/settings.py b/attendio/settings.py index 3d97daf..67553d1 100644 --- a/attendio/settings.py +++ b/attendio/settings.py @@ -42,7 +42,8 @@ INSTALLED_APPS = [ 'allauth', 'allauth.account', 'allauth.mfa', - 'publicweb.apps.PublicwebConfig' + 'publicweb.apps.PublicwebConfig', + 'app.apps.AppConfig' ] MIDDLEWARE = [ diff --git a/attendio/urls.py b/attendio/urls.py index 9272d88..760ad2b 100644 --- a/attendio/urls.py +++ b/attendio/urls.py @@ -26,5 +26,6 @@ urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('allauth.urls')), path("accounts/profile/", TemplateView.as_view(template_name="profile.html")), + path("app/", include("app.urls", "app")), path("", include("publicweb.urls")), ] diff --git a/templates/app/base.html b/templates/app/base.html index 0f21b8d..334f49e 100644 --- a/templates/app/base.html +++ b/templates/app/base.html @@ -7,7 +7,7 @@ <header> <nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> - <a class="navbar-brand" href="{% url "index" %}">attendio</a> + <a class="navbar-brand" href="{% if user.is_authenticated %}{% url "app:home" %}{% else %}{% url "index" %}{% endif %}">attendio</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" @@ -22,10 +22,7 @@ aria-label="Project links" class="navbar-nav me-auto mb-2 mb-lg-0"> <li class="nav-item"> - <a class="nav-link active" href="https://docs.allauth.org/">Documentation</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="https://codeberg.org/allauth/django-allauth">Repository</a> + <a class="nav-link" href="https://docs.allauth.org/">Documentation</a> </li> </ul> <div class="d-flex flex-column flex-sm-row gap-2 col-lg-3 justify-content-lg-end text-nowrap"> diff --git a/templates/app/home.html b/templates/app/home.html index a77210a..c9f745e 100644 --- a/templates/app/home.html +++ b/templates/app/home.html @@ -1,8 +1,8 @@ {% extends 'app/base.html' %} {% load django_bootstrap5 %} -{% block title %}django-bootstrap5{% endblock %} +{% block title %}Attendio Home{% endblock %} {% block content %} - This is <em>bootstrap5</em> for <strong>Django</strong>. + Browse the companies you are a part of here. {% endblock %} \ No newline at end of file diff --git a/templates/pub/index.html b/templates/pub/index.html index a77210a..446c7a8 100644 --- a/templates/pub/index.html +++ b/templates/pub/index.html @@ -1,7 +1,7 @@ {% extends 'app/base.html' %} {% load django_bootstrap5 %} -{% block title %}django-bootstrap5{% endblock %} +{% block title %}Attendio{% endblock %} {% block content %} This is <em>bootstrap5</em> for <strong>Django</strong>. -- GitLab