Skip to content

Commit faef177

Browse files
committed
cleaning up, and styling fixes
1 parent f8e131e commit faef177

72 files changed

Lines changed: 306 additions & 697 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CYAN ?= \033[0;36m
22
COFF ?= \033[0m
33

4-
.PHONY: deps lint check test help test_app test_user seed_data seed_small seed_large build publish publish-test publish-test-only version
4+
.PHONY: deps lint check test help test_app test_user build publish publish-test publish-test-only version
55
.EXPORT_ALL_VARIABLES:
66

77
.DEFAULT: help
@@ -36,21 +36,6 @@ test_app: ## Run the test app
3636
test_user: ## Make the test user
3737
uv run python tests/test_app/manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('test@test.com', password='test')"
3838

39-
seed_data: ## Seed database with sample data (medium dataset)
40-
@printf "$(CYAN)Seeding database with sample data$(COFF)\n"
41-
uv run python tests/test_app/manage.py migrate
42-
uv run python tests/test_app/manage.py seed_data --clear
43-
44-
seed_small: ## Seed database with small dataset (fast)
45-
@printf "$(CYAN)Seeding database with small dataset$(COFF)\n"
46-
uv run python tests/test_app/manage.py migrate
47-
uv run python tests/test_app/manage.py seed_data --small --clear
48-
49-
seed_large: ## Seed database with large dataset (comprehensive testing)
50-
@printf "$(CYAN)Seeding database with large dataset$(COFF)\n"
51-
uv run python tests/test_app/manage.py migrate
52-
uv run python tests/test_app/manage.py seed_data --large --clear
53-
5439
build: ## Build the package
5540
uv build --no-sources
5641

@@ -77,9 +62,9 @@ version-prerelease: ## Bump to next prerelease (for pre-release workflow)
7762
uv version --bump patch --bump alpha --frozen
7863

7964

80-
download_bootswatch_css: ## Download the Bootswatch CSS files
65+
download_bootswatch_css: ## Download the Bootswatch CSS and source map files
8166
for theme in default brite cerulean cosmo cyborg darkly flatly journal litera lumen lux materia minty morph pulse quartz sandstone simplex sketchy slate solar spacelab superhero united vapor yeti zephyr; do \
8267
mkdir -p jazzmin/static/vendor/bootswatch/$${theme}; \
8368
curl -s https://bootswatch.com/5/$${theme}/bootstrap.min.css -o jazzmin/static/vendor/bootswatch/$${theme}/bootstrap.min.css; \
84-
sed -i '/sourceMappingURL/d' jazzmin/static/vendor/bootswatch/$${theme}/bootstrap.min.css; \
69+
curl -s https://bootswatch.com/5/$${theme}/bootstrap.min.css.map -o jazzmin/static/vendor/bootswatch/$${theme}/bootstrap.min.css.map; \
8570
done

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ them as quickly as I would like, but im trying to get through them all now, hope
1919
[![Docs](https://readthedocs.org/projects/django-jazzmin/badge/?version=latest)](https://django-jazzmin.readthedocs.io)
2020
![PyPI download month](https://img.shields.io/pypi/dm/django-jazzmin.svg)
2121
[![PyPI version](https://badge.fury.io/py/django-jazzmin.svg)](https://pypi.python.org/pypi/django-jazzmin/)
22-
![Python versions](https://img.shields.io/badge/python-%3E=3.9-brightgreen)
22+
![Python versions](https://img.shields.io/badge/python-%3E=3.10-brightgreen)
2323
![Django Versions](https://img.shields.io/badge/django-%3E=4.2-brightgreen)
2424
[![Coverage Status](https://coveralls.io/repos/github/farridav/django-jazzmin/badge.svg?branch=main)](https://coveralls.io/github/farridav/django-jazzmin?branch=main)
2525

docs/bugs_and_features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Some useful links for feature development:
3636
- [https://adminlte.io/themes/v3/index3.html](https://adminlte.io/themes/v3/index3.html)
3737
- [https://adminlte.io/docs/3.0/index.html](https://adminlte.io/docs/3.0/index.html)
3838
- [Font awesome 5.13.0 free icons](https://fontawesome.com/icons?d=gallery&m=free&v=5.0.0,5.0.1,5.0.10,5.0.11,5.0.12,5.0.13,5.0.2,5.0.3,5.0.4,5.0.5,5.0.6,5.0.7,5.0.8,5.0.9,5.1.0,5.1.1,5.2.0,5.3.0,5.3.1,5.4.0,5.4.1,5.4.2,5.13.0,5.12.0,5.11.2,5.11.1,5.10.0,5.9.0,5.8.2,5.8.1,5.7.2,5.7.1,5.7.0,5.6.3,5.5.0,5.4.2)
39-
- [https://getbootstrap.com/docs/4.5/getting-started/introduction/](https://getbootstrap.com/docs/4.5/getting-started/introduction/)
39+
- [https://getbootstrap.com/docs/5.3/getting-started/introduction/](https://getbootstrap.com/docs/5.3/getting-started/introduction/)

docs/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ JAZZMIN_SETTINGS = {
131131
"use_google_fonts_cdn": True,
132132
# Whether to show the UI customizer on the sidebar
133133
"show_ui_builder": False,
134+
# Whether to show the theme chooser dropdown in the top navbar
135+
"show_theme_chooser": False,
134136

135137
###############
136138
# Change view #
@@ -343,7 +345,7 @@ class BookAdmin(admin.ModelAdmin):
343345
You can enable a language chooser dropdown using `"language_chooser": True` in your `JAZZMIN_SETTINGS`, we mainly use this for
344346
assisting with translations, but it could be of use to some people in their admin site.
345347

346-
To make proper use of this, please ensure you have internationalisation setup properly, See [https://docs.djangoproject.com/en/3.1/topics/i18n/translation/](https://docs.djangoproject.com/en/3.1/topics/i18n/translation/)
348+
To make proper use of this, please ensure you have internationalisation setup properly, See [https://docs.djangoproject.com/en/stable/topics/i18n/translation/](https://docs.djangoproject.com/en/stable/topics/i18n/translation/)
347349

348350
Namely:
349351

docs/development.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,42 @@
22

33
## Installation
44

5-
This project manages dependencies using [poetry](https://python-poetry.org/)
5+
This project manages dependencies using [uv](https://docs.astral.sh/uv/)
66

7-
Ensure you have poetry installed (`pip install poetry`)
7+
Ensure you have uv installed (see [uv installation docs](https://docs.astral.sh/uv/getting-started/installation/))
88

9-
Then get setup with `poetry install`
9+
Then get setup:
1010

1111
git clone git@github.com:farridav/django-jazzmin.git
12-
poetry install
12+
cd django-jazzmin
13+
make deps
1314

1415
## Running the test project
1516

1617
Setup db tables etc.
1718

18-
python tests/test_app/manage.py migrate
19+
uv run python tests/test_app/manage.py migrate
1920

2021
Generate test data
2122

22-
python tests/test_app/manage.py reset
23+
uv run python tests/test_app/manage.py reset
2324

2425
Run development server (with werkzeug debugger)
2526

26-
python tests/test_app/manage.py runserver_plus
27+
uv run python tests/test_app/manage.py runserver_plus
28+
29+
Or simply use the Makefile:
30+
31+
make test_app
2732

2833
## Running the tests
2934

3035
Tests are run via github actions on any pull request into `main`, and are written for use with the [pytest](https://docs.pytest.org/en/latest/)
3136
framework, we should have good enough tests for you to base your own off of, though where we are lacking, feel free to contribute,
3237
but keep it clean, concise and simple, leave the magic to the wizards.
3338

34-
Run the test suite with your current python interpreter and Django version using `pytest` or target an individual test
35-
with `pytest -k my_test_name`
36-
37-
Run against all supported Python and Django Versions using `tox`
39+
Run the test suite with `make test` or target an individual test
40+
with `uv run pytest -k my_test_name`
3841

3942
## Contribution guidelines
4043

@@ -47,7 +50,7 @@ Run against all supported Python and Django Versions using `tox`
4750

4851
## Coding guidelines
4952

50-
- autoformat your code with [black](https://github.com/psf/black)
53+
- autoformat your code with `make lint` (uses [ruff](https://docs.astral.sh/ruff/))
5154
- When fixing something display related, please bear the following in mind:
5255
- Try fixing the problem using HTML, else CSS, else JS
5356
- Try removing code, else changing code, else adding code

docs/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ Live demo https://django-jazzmin-test.onrender.com
3232
You can also view the demo app by cloning the repository, and running the following commands:
3333

3434
```bash
35-
poetry install
36-
./tests/test_app/manage.py migrate
37-
./tests/test_app/manage.py reset
38-
./tests/test_app/manage.py runserver_plus
35+
make deps
36+
make test_app
3937
```
4038

4139
## Screenshots

docs/ui_customisation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ below.
5959
### Available themes
6060

6161
- default (standard Bootstrap-based theme)
62+
- brite [preview](https://bootswatch.com/brite/)
6263
- cerulean [preview](https://bootswatch.com/cerulean/)
6364
- cosmo [preview](https://bootswatch.com/cosmo/)
6465
- cyborg [preview](https://bootswatch.com/cyborg/)

jazzmin/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
"use_google_fonts_cdn": True,
8585
# Whether to show the UI customizer on the sidebar
8686
"show_ui_builder": False,
87+
# Whether to show the theme chooser dropdown in the top navbar
88+
"show_theme_chooser": False,
8789
###############
8890
# Change view #
8991
###############
@@ -345,6 +347,7 @@ def classes(*args: str) -> str:
345347
"brand_classes": classes("brand_small_text", "brand_colour"),
346348
"footer_classes": classes("footer_small_text"),
347349
"button_classes": tweaks["button_classes"],
350+
"theme_list": list(THEMES.keys()),
348351
}
349352

350353
return ret

jazzmin/static/jazzmin/css/main.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,22 @@ html[data-bs-theme="dark"] .selector select option:checked {
500500
}
501501

502502

503+
/* ============================================================================
504+
CHANGELIST - Checkbox select-all column
505+
========================================================================== */
506+
.djn-checkbox-select-all {
507+
width: 1.5em;
508+
text-align: center;
509+
padding-right: 0 !important;
510+
}
511+
512+
.table td.action-checkbox {
513+
width: 1.5em;
514+
text-align: center;
515+
padding-right: 0 !important;
516+
}
517+
518+
503519
/* ============================================================================
504520
USER PANEL - Sidebar user info (not a native AdminLTE v4 component)
505521
========================================================================== */

jazzmin/static/jazzmin/js/main.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,71 @@
4848
$main_li_parent.addClass('menu-is-opening menu-open');
4949
};
5050

51+
function initThemeChooser() {
52+
const $themeSelect = $('#jazzmin-theme-select');
53+
const $modeSelect = $('#jazzmin-mode-select');
54+
55+
if (!$themeSelect.length && !$modeSelect.length) {
56+
return;
57+
}
58+
59+
// Restore saved theme from localStorage
60+
const savedTheme = localStorage.getItem('jazzmin-theme');
61+
if (savedTheme && $themeSelect.length) {
62+
$themeSelect.val(savedTheme);
63+
}
64+
65+
// Restore saved mode from localStorage
66+
const savedMode = localStorage.getItem('jazzmin-theme-mode');
67+
if (savedMode && $modeSelect.length) {
68+
$modeSelect.val(savedMode);
69+
}
70+
71+
// Theme switching — #jazzmin-theme link is always present in the DOM
72+
$themeSelect.on('change', function () {
73+
const newTheme = $(this).val();
74+
const $themeCSS = $('#jazzmin-theme');
75+
const base = $themeCSS.data('theme-base');
76+
77+
if (newTheme === 'default') {
78+
$themeCSS.removeAttr('href');
79+
} else {
80+
$themeCSS.attr('href', base + '/' + newTheme + '/bootstrap.min.css');
81+
}
82+
83+
$('body').removeClass(function (index, className) {
84+
return (className.match(/(^|\s)theme-\S+/g) || []).join(' ');
85+
}).addClass('theme-' + newTheme);
86+
87+
localStorage.setItem('jazzmin-theme', newTheme);
88+
});
89+
90+
// Color scheme switching
91+
$modeSelect.on('change', function () {
92+
const mode = $(this).val();
93+
var resolved = mode === 'auto'
94+
? (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
95+
: mode;
96+
document.documentElement.setAttribute('data-bs-theme', resolved);
97+
localStorage.setItem('jazzmin-theme-mode', mode);
98+
});
99+
100+
// Keep dropdown open when interacting with selects
101+
$('#jazzy-theme-chooser').on('click', function (e) {
102+
e.stopPropagation();
103+
});
104+
}
105+
51106
$(document).ready(function () {
52107
// Set active status on links
53108
setActiveLinks()
54109

55110
// When we use the menu, store its state in a cookie to preserve it
56111
handleMenu();
57112

113+
// Theme chooser (navbar dropdown)
114+
initThemeChooser();
115+
58116
// Add minimal changelist styling to templates that we have been unable to override (e.g MPTT)
59117
// Needs to be here and not in change_list.js because this is the only JS we are guaranteed to run
60118
// (as its included in base.html)

0 commit comments

Comments
 (0)