From 1727d4aa798bd5f377bfe87c80f139483caa38bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Thu, 13 Oct 2022 00:35:45 +0200 Subject: [PATCH] Upgrade Django to 3.2 Bump to latest version of Django 3.2 Fix dark theme issue by fixing the order of css imports in admin Cleanup admin login template (remove copied code as far as possible) --- AKModel/templates/admin/login.html | 17 +---------------- requirements.txt | 2 +- static_common/common/css/admin-bootstrap.css | 6 ++++++ templates/admin/base_site.html | 3 ++- 4 files changed, 10 insertions(+), 18 deletions(-) create mode 100644 static_common/common/css/admin-bootstrap.css diff --git a/AKModel/templates/admin/login.html b/AKModel/templates/admin/login.html index 8a61f6d1..705a126f 100644 --- a/AKModel/templates/admin/login.html +++ b/AKModel/templates/admin/login.html @@ -1,21 +1,6 @@ -{% extends "admin/base_site.html" %} +{% extends "admin/login.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}"> -{{ form.media }} -{% endblock %} - -{% block bodyclass %}{{ block.super }} login{% endblock %} - -{% block usertools %}{% endblock %} - -{% block nav-global %}{% endblock %} - -{% block nav-sidebar %}{% endblock %} - -{% block content_title %}{% endblock %} - -{% block breadcrumbs %}{% endblock %} {% block content %} {% if form.errors and not form.non_field_errors %} diff --git a/requirements.txt b/requirements.txt index 9213a6a7..8c66a5e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==3.1.8 +Django==3.2.16 django-bootstrap4==2.3.1 django-fontawesome-5==1.0.18 django-split-settings==1.0.1 diff --git a/static_common/common/css/admin-bootstrap.css b/static_common/common/css/admin-bootstrap.css new file mode 100644 index 00000000..c0b4714c --- /dev/null +++ b/static_common/common/css/admin-bootstrap.css @@ -0,0 +1,6 @@ +/* + Load both the django admin base style and bootstrap -- but make sure bootstrap is loaded first to override all critical theme settings from bootstrap with the default admin style. + This especially fixes the dark theme. +*/ +@import "/static/common/css/bootstrap.css"; +@import "../../admin/css/base.css"; diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html index 05eee8a8..0fbdfeb4 100644 --- a/templates/admin/base_site.html +++ b/templates/admin/base_site.html @@ -4,6 +4,8 @@ {% load fontawesome_5 %} {% load static %} +{% block stylesheet %}{% static "common/css/admin-bootstrap.css" %}{% endblock %} + {% block extrastyle %} {% if not debug %} <link rel="stylesheet" type="text/css" href="{% static "common/css/admin-color.css" %}"/> @@ -12,7 +14,6 @@ {% block extrahead %} <!-- Load bootstrap, jquery and fontawesome--> - {% bootstrap_css %} {% bootstrap_javascript jquery=True %} {% fontawesome_5_static %} -- GitLab