From 4392b58dc94e6b58249fcce98adf041bcdb07bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20T=C3=BA=20Anh?= Date: Wed, 21 Oct 2026 21:32:06 +0700 Subject: [PATCH] v0.4.1.1: CKEditor readable in light and dark mode, working guest login button Patch release with PR #26 (guest login button and errors) and PR #27 (CKEditor theme as plain CSS over --ck-* variables). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 13 +- README.md | 15 ++- docs/reports/releases/2026-10-21-v0.4.1.1.md | 132 +++++++++++++++++++ pyproject.toml | 2 +- uv.lock | 2 +- whiteneuron/__init__.py | 4 +- 6 files changed, 161 insertions(+), 7 deletions(-) create mode 100644 docs/reports/releases/2026-10-21-v0.4.1.1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b94c0..5799f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog -### v0.4.1.0 (2026-10-16) — latest +### v0.4.1.1 (2026-10-21) — latest +**Patch release: CKEditor readable in light and dark mode, working "Log in as guest" button** +- **Fixed**: CKEditor fields (`text_field_widget = "ckeditor"`, `CKEditor5Widget`) had a transparent editor and toolbar, and in dark mode black text on the dark background. `base/css/ckeditor5.css` was Tailwind source served without a build, so browsers dropped its rules. It is now plain CSS that only overrides CKEditor's `--ck-*` variables with Unfold's colors, in light mode and in Unfold's dark mode (`html.dark`, also set by dark daisyUI themes). This covers the toolbar, dialogs, captions, todo checkboxes, code blocks and find & replace matches. Editor content uses Inter. +- **Fixed**: the login page's "Log in as guest" button had no background (`bg-secondary-600` was never compiled). It now uses Unfold's secondary button and appears only when an active staff `guest` account exists (new `{% guest_login_available %}` tag in the `wn_guest` library). +- **Fixed**: a failed guest login silently returned to the login page. `GuestLoginView` now shows "Guest login is not available." and keeps `?next`. It also works under Django's `LoginRequiredMiddleware` and lets any logged-in user switch to guest. A failed switch restores the previous session instead of returning a 500 (read-only database with DB-backed sessions). `?next` must have the same host and scheme. +- **Fixed**: `AutoGuestLoginMiddleware` raised `NoReverseMatch` for `?next=` (it was resolved as a URL name) and hid errors. It now redirects to the URL and logs failures. +- **Changed**: Tailwind no longer scans its own output (`styles.css`), so rebuilds are reproducible. +- **Docs**: `docs/CKEDITOR5_CUSTOMIZATION.md` rewritten: there is no build step, and a project extends the packaged theme by `@import`ing it from its own `CKEDITOR_5_CUSTOM_CSS`. +- **Tests**: guest login button, view and middleware (13 tests); `ckeditor5.css` contains no Tailwind syntax and overrides every fixed CKEditor light color for dark mode, or lists it as reviewed, so a django-ckeditor-5 upgrade that adds one fails the suite. +- **Upgrade**: `pip install -U django-whiteneuron==0.4.1.1`, `collectstatic`. No migrations or new settings. Projects with their own `CKEDITOR_5_CUSTOM_CSS` are unaffected. Docker base images `v0.4.1.1` are published by the release workflow. + +### v0.4.1.0 (2026-10-16) **Feature release: admin About page (application / base versions and release dates)** - **Added**: admin **About** page (`/admin/about/`, sidebar *System → About*, URL name `admin:about`). Every staff user sees the application name, version, release date and short build id (`VERSION`, `RELEASE_DATE`, `BUILD_ID` / `GIT_COMMIT`, cut to 12 characters) and the django-whiteneuron version and release date with a changelog link; superusers also see Python/Django/Unfold versions, database engine, debug mode, time zone, server time, process start and uptime. - **Added**: `APP_INFO_CALLBACK` setting (`"path.to.func"`, `func(request) -> [(label, value), ...]`) for project rows on the About page; a failing callback is logged and skipped. diff --git a/README.md b/README.md index bb68a0a..b39cb39 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,22 @@ A modern Django Admin extension focused on UI/UX, dashboard, feedback, file mana ![django-whiteneuron](https://raw.githubusercontent.com/White-Neuron/django-whiteneuron/main2.0/docs/images/main.png) ## Current Version -v0.4.1.0 +v0.4.1.1 ## Changelog -### Latest: v0.4.1.0 (2026-10-16) +### Latest: v0.4.1.1 (2026-10-21) +**Patch release: CKEditor readable in light and dark mode, working "Log in as guest" button** +- **Fixed**: CKEditor fields (`text_field_widget = "ckeditor"`, `CKEditor5Widget`) had a transparent editor and toolbar, and in dark mode black text on the dark background. `base/css/ckeditor5.css` was Tailwind source served without a build, so browsers dropped its rules. It is now plain CSS that only overrides CKEditor's `--ck-*` variables with Unfold's colors, in light mode and in Unfold's dark mode (`html.dark`, also set by dark daisyUI themes). This covers the toolbar, dialogs, captions, todo checkboxes, code blocks and find & replace matches. Editor content uses Inter. +- **Fixed**: the login page's "Log in as guest" button had no background (`bg-secondary-600` was never compiled). It now uses Unfold's secondary button and appears only when an active staff `guest` account exists (new `{% guest_login_available %}` tag in the `wn_guest` library). +- **Fixed**: a failed guest login silently returned to the login page. `GuestLoginView` now shows "Guest login is not available." and keeps `?next`. It also works under Django's `LoginRequiredMiddleware` and lets any logged-in user switch to guest. A failed switch restores the previous session instead of returning a 500 (read-only database with DB-backed sessions). `?next` must have the same host and scheme. +- **Fixed**: `AutoGuestLoginMiddleware` raised `NoReverseMatch` for `?next=` (it was resolved as a URL name) and hid errors. It now redirects to the URL and logs failures. +- **Changed**: Tailwind no longer scans its own output (`styles.css`), so rebuilds are reproducible. +- **Docs**: `docs/CKEDITOR5_CUSTOMIZATION.md` rewritten: there is no build step, and a project extends the packaged theme by `@import`ing it from its own `CKEDITOR_5_CUSTOM_CSS`. +- **Tests**: guest login button, view and middleware (13 tests); `ckeditor5.css` contains no Tailwind syntax and overrides every fixed CKEditor light color for dark mode, or lists it as reviewed, so a django-ckeditor-5 upgrade that adds one fails the suite. +- **Upgrade**: `pip install -U django-whiteneuron==0.4.1.1`, `collectstatic`. No migrations or new settings. Projects with their own `CKEDITOR_5_CUSTOM_CSS` are unaffected. Docker base images `v0.4.1.1` are published by the release workflow. + +### v0.4.1.0 (2026-10-16) **Feature release: admin About page (application / base versions and release dates)** - **Added**: admin **About** page (`/admin/about/`, sidebar *System → About*, URL name `admin:about`). Every staff user sees the application name, version, release date and short build id (`VERSION`, `RELEASE_DATE`, `BUILD_ID` / `GIT_COMMIT`, cut to 12 characters) and the django-whiteneuron version and release date with a changelog link; superusers also see Python/Django/Unfold versions, database engine, debug mode, time zone, server time, process start and uptime. - **Added**: `APP_INFO_CALLBACK` setting (`"path.to.func"`, `func(request) -> [(label, value), ...]`) for project rows on the About page; a failing callback is logged and skipped. diff --git a/docs/reports/releases/2026-10-21-v0.4.1.1.md b/docs/reports/releases/2026-10-21-v0.4.1.1.md new file mode 100644 index 0000000..19f5653 --- /dev/null +++ b/docs/reports/releases/2026-10-21-v0.4.1.1.md @@ -0,0 +1,132 @@ +# Release Notes: v0.4.1.1 + +**Date**: 2026-10-21 +**Type**: Patch release (no migrations, no new settings, no breaking changes) +**Scope**: CKEditor theme in light and dark mode; "Log in as guest" button and guest login errors + +--- + +## Summary + +v0.4.1.1 fixes two things that looked broken to admin users. CKEditor fields were transparent, and +in dark mode their text was black on a dark background. The guest login button had no background, +and when no guest account was usable it did nothing. Both now work in light mode, dark mode and +every daisyUI theme. + +--- + +## Fixed + +### CKEditor theme (PR #27) +`CKEDITOR_5_CUSTOM_CSS = "base/css/ckeditor5.css"` is linked as-is by django-ckeditor-5, but the +file was Tailwind source that no build step compiled. Browsers dropped 100 of its 108 rules, and the +`theme()` values made the `--ck-color-*` overrides invalid. The editor and toolbar became +transparent, and in dark mode the content kept CKEditor's black text. + +The file is now plain CSS with no build step. It only overrides CKEditor's `--ck-*` variables, which +is CKEditor's documented theming method, so every editor feature keeps CKEditor's own styles. + +| Mode | What follows Unfold's colors | +|---|---| +| Light | borders, text, focus border and glow, links, "on" buttons; content font Inter | +| Dark (`html.dark`) | the base colors most of CKEditor's UI derives from, plus every fixed light color that would be unreadable: buttons and inputs, placeholders, selection, links, shadows, captions and their highlight flash, the keyboard shortcuts dialog (Alt+0), the style panel, table border helpers, content text | +| Dark, rules | code block text, todo checkbox borders, find & replace matches (colors CKEditor sets without a variable) | + +Dark mode follows Unfold's `dark` class on ``, which dark daisyUI themes also set. + +### "Log in as guest" (PR #26) +- The button used `bg-secondary-600`, which was never compiled into `styles.css`, so it read as plain + text. It now uses Unfold's secondary button, like the other login buttons. +- The button appears only when an active staff `guest` account exists. The check is the new + `{% guest_login_available %}` tag (`{% load wn_guest %}`), so it works on any admin site that + renders `admin/login.html`. +- `GuestLoginView`: + - shows "Guest login is not available." when the login fails, and returns to the login page with + the original `?next` + - is marked `login_not_required`, so it works with Django's `LoginRequiredMiddleware` + - lets any logged-in user on the login page switch to guest + - restores the previous session when the switch fails, instead of returning a 500 (read-only + database with DB-backed sessions). A read-only database that refuses only the `last_login` + write (demo mode) still logs the guest in, as before + - accepts `?next` only on the same host and scheme +- `AutoGuestLoginMiddleware` resolved `?next` as a URL name, so `?next=/admin/foo/` raised + `NoReverseMatch`. It now redirects to the URL, and logs failures instead of ignoring them. + +--- + +## Changed +- Tailwind no longer scans its own output (`whiteneuron/static/base/css/styles.css`). Removed + utilities kept their theme variables alive, so rebuilds weren't reproducible. +- `docs/CKEDITOR5_CUSTOMIZATION.md` is rewritten. It described a build step and a JS file that + don't exist. + +--- + +## Tests +- `GuestLoginButtonTests`, `AutoGuestLoginMiddlewareTests` (13 tests). +- `CKEditorCustomCssTests`: + - the packaged `ckeditor5.css` contains no Tailwind syntax (`@apply`, `theme(`, `@theme`, + `@utility`, `@variant`, ...) + - every fixed light color in CKEditor's CSS is overridden for dark mode or listed as reviewed + (accents, translucent overlays, badges). A django-ckeditor-5 upgrade that adds one fails the + suite instead of shipping light-on-dark text. + +--- + +## Files changed + +| File | Change | +|---|---| +| `whiteneuron/static/base/css/ckeditor5.css` | rewritten as plain CSS, `--ck-*` variables only | +| `docs/CKEDITOR5_CUSTOMIZATION.md` | rewritten | +| `whiteneuron/templates/admin/login_after.html` | guest button style and visibility | +| `whiteneuron/base/templatetags/wn_guest.py` | new `guest_login_available` tag | +| `whiteneuron/base/utils.py` | `get_guest_user`, `log_in_guest`, `safe_next_url` | +| `whiteneuron/base/views.py` | `GuestLoginView` error message, `?next`, session restore | +| `whiteneuron/base/middleware.py` | `AutoGuestLoginMiddleware` redirect and logging | +| `whiteneuron/locale/vi/LC_MESSAGES/django.po`, `.mo` | "Guest login is not available." | +| `styles.css`, `whiteneuron/static/base/css/styles.css` | Tailwind source exclusion, rebuilt CSS | +| `whiteneuron/base/tests_regressions.py` | tests above | +| `pyproject.toml`, `uv.lock`, `whiteneuron/__init__.py`, `CHANGELOG.md`, `README.md` | version 0.4.1.1 | + +--- + +## Compatibility / Upgrade + +```bash +pip install -U django-whiteneuron==0.4.1.1 +python manage.py collectstatic +``` + +- No migrations, no new settings. +- Projects that set their own `CKEDITOR_5_CUSTOM_CSS` are unaffected. To build on the packaged theme + instead of replacing it, start your file with + `@import url("../../base/css/ckeditor5.css");` (path relative to your file) and override + variables after it. See `docs/CKEDITOR5_CUSTOMIZATION.md`. +- Projects that override `admin/login_after.html` keep their own button. To hide it when no guest + account exists, wrap it in `{% load wn_guest %}{% guest_login_available as can_guest %}{% if can_guest %}...{% endif %}`. +- Translators: new msgid `Guest login is not available.` (Vietnamese included). +- Docker base images `django-whiteneuron-{alpine,debian}:v0.4.1.1` are published by the release + workflow; WN-Sense can set `BASE=v0.4.1.1`. + +### Known issues (unchanged) +- Unfold's preflight resets typography inside the editor (headings at body size, hidden list + bullets). +- `AutoGuestLoginMiddleware` is enabled when `SKIP_GUEST_LOGIN=True`, the opposite of what the name + suggests. It is kept as is because changing it would affect existing projects. + +### Rollback +Revert to v0.4.1.0. There are no schema or settings changes. + +--- + +## Validation +- [x] `manage.py test whiteneuron`: 75 tests pass +- [x] `check` clean; `makemigrations --check`: no changes +- [x] `msgfmt --check` on the Vietnamese catalog +- [x] Tailwind build reproducible (`bash scripts/tailwind.sh` leaves `styles.css` unchanged) +- [x] `uv build` produces the wheel and sdist; `twine check` passes +- [x] Chrome: CKEditor with Unfold's CSS and colors, light and dark (toolbar, content, find & replace, + Alt+0 dialog, todo list, code block, captions) +- [x] Chromium: guest button in light and dark, guest login, hidden button and error message with + the guest deactivated (PR #26) diff --git a/pyproject.toml b/pyproject.toml index 777948a..4adc2fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "django-whiteneuron" -version = "0.4.1.0" +version = "0.4.1.1" description = "A modern Django Admin extension with enhanced UI/UX, dashboard, feedback, file management, rate limiting, IP blacklisting, and advanced admin integrations built on django-unfold." authors = [ {name = "White Neuron", email = "anhnt@whiteneuron.ai"} diff --git a/uv.lock b/uv.lock index 5b7fff8..e5cb88f 100644 --- a/uv.lock +++ b/uv.lock @@ -688,7 +688,7 @@ wheels = [ [[package]] name = "django-whiteneuron" -version = "0.4.1.0" +version = "0.4.1.1" source = { editable = "." } dependencies = [ { name = "channels" }, diff --git a/whiteneuron/__init__.py b/whiteneuron/__init__.py index 8da7f1e..6ba4b67 100644 --- a/whiteneuron/__init__.py +++ b/whiteneuron/__init__.py @@ -1,3 +1,3 @@ # Keep in sync with pyproject.toml and CHANGELOG.md (checked by the test suite) -__version__ = "0.4.1.0" -__release_date__ = "2026-10-16" +__version__ = "0.4.1.1" +__release_date__ = "2026-10-21"