From 654d0c39074a53f6685a23ac9cee875562d0c871 Mon Sep 17 00:00:00 2001
From: TheJoeCoder <joe@radialbog9.uk>
Date: Wed, 6 Nov 2024 21:06:36 +0000
Subject: [PATCH] Fix layouts and urls

---
 attendio/settings.py                 | 3 ++-
 attendio/urls.py                     | 6 ++++++
 publicweb/urls.py                    | 3 ++-
 publicweb/views.py                   | 5 +----
 templates/allauth/elements/form.html | 1 +
 templates/allauth/layouts/base.html  | 2 --
 templates/app/base.html              | 6 +++---
 7 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/attendio/settings.py b/attendio/settings.py
index 7ed42f9..3d97daf 100644
--- a/attendio/settings.py
+++ b/attendio/settings.py
@@ -140,7 +140,8 @@ STATIC_URL = 'static/'
 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
 BOOTSTRAP5 = {
-    # "theme_url": "https://bootswatch.com/5/vapor/bootstrap.min.css"
+    # "theme_url": "https://bootswatch.com/5/vapor/bootstrap.min.css",
+    "color_mode": "dark",
 }
 
 MFA_SUPPORTED_TYPES = ["totp", "webauthn", "recovery_codes"]
diff --git a/attendio/urls.py b/attendio/urls.py
index a2a61d8..9272d88 100644
--- a/attendio/urls.py
+++ b/attendio/urls.py
@@ -14,11 +14,17 @@ Including another URLconf
     1. Import the include() function: from django.urls import include, path
     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
 """
+from allauth.account.decorators import secure_admin_login
 from django.contrib import admin
 from django.urls import path, include
+from django.views.generic import TemplateView
+
+admin.autodiscover()
+admin.site.login = secure_admin_login(admin.site.login)
 
 urlpatterns = [
     path('admin/', admin.site.urls),
     path('accounts/', include('allauth.urls')),
+    path("accounts/profile/", TemplateView.as_view(template_name="profile.html")),
     path("", include("publicweb.urls")),
 ]
diff --git a/publicweb/urls.py b/publicweb/urls.py
index c8344e7..2acf6cc 100644
--- a/publicweb/urls.py
+++ b/publicweb/urls.py
@@ -1,7 +1,8 @@
 from django.urls import path
+from django.views.generic import TemplateView
 
 from publicweb import views
 
 urlpatterns = [
-    path("", views.index, name="index"),
+    path("", TemplateView.as_view(template_name="pub/index.html"), name="index"),
 ]
\ No newline at end of file
diff --git a/publicweb/views.py b/publicweb/views.py
index 7dd0aec..7e324b4 100644
--- a/publicweb/views.py
+++ b/publicweb/views.py
@@ -1,4 +1 @@
-from django.shortcuts import render
-
-def index(request):
-    return render(request, 'pub/index.html')
\ No newline at end of file
+# Views go here
diff --git a/templates/allauth/elements/form.html b/templates/allauth/elements/form.html
index aef7614..d087e86 100644
--- a/templates/allauth/elements/form.html
+++ b/templates/allauth/elements/form.html
@@ -12,3 +12,4 @@
         {% endslot %}
         {% if not attrs.no_visible_fields %}</div>{% endif %}
 </form>
+<br>
\ No newline at end of file
diff --git a/templates/allauth/layouts/base.html b/templates/allauth/layouts/base.html
index 29c3ffb..7b40d95 100644
--- a/templates/allauth/layouts/base.html
+++ b/templates/allauth/layouts/base.html
@@ -7,8 +7,6 @@
     <div class="container">
         <br>
 
-        {% autoescape off %}{% bootstrap_messages %}{% endautoescape %}
-
         {% block body %}
             {% block content %}
             {% endblock content %}
diff --git a/templates/app/base.html b/templates/app/base.html
index f383d25..0f21b8d 100644
--- a/templates/app/base.html
+++ b/templates/app/base.html
@@ -4,7 +4,7 @@
 
 {% block bootstrap5_before_content %}
     <a class="visually-hidden-focusable" href="#content">Skip to main content</a>
-    <header data-bs-theme="dark">
+    <header>
             <nav class="navbar navbar-expand-lg bg-body-tertiary">
                 <div class="container-fluid">
                     <a class="navbar-brand" href="{% url "index" %}">attendio</a>
@@ -36,7 +36,7 @@
                                     <a href="{% if email_url_ %}{{ email_url_ }}{% else %}{{ socialaccount_url_ }}{% endif %}"
                                        class="btn btn-secondary">Manage Account</a>
                                 {% endif %}
-                                <a href="{% url 'account_logout' %}" class="btn btn-danger">Sign Out}</a>
+                                <a href="{% url 'account_logout' %}" class="btn btn-danger">Sign Out</a>
                             {% else %}
                                 <a href="{% url 'account_login' %}" class="btn btn-outline-light">Sign In</a>
                                 {% url 'account_signup' as signup_url_ %}
@@ -56,7 +56,7 @@
     <div class="container">
         <br>
         <h1>{% block title %}(no title){% endblock %}</h1>
-    
+
         {% autoescape off %}{% bootstrap_messages %}{% endautoescape %}
 
         {% block content %}
-- 
GitLab