Skip to content

Django 5.2 Upgrade#900

Open
chrismaddalena wants to merge 49 commits into
masterfrom
django-5-2-upgrade
Open

Django 5.2 Upgrade#900
chrismaddalena wants to merge 49 commits into
masterfrom
django-5-2-upgrade

Conversation

@chrismaddalena

Copy link
Copy Markdown
Collaborator

CHANGELOG

[7.1.0] - TBD

Added

  • Added a workflow to check the GraphQL codegen whenever models change to ensure there is no drift (Closes [Task] Workflow for checking frontend GraphQL codegen #849)
  • Added tracking for the active report in the browser's localstorage along with a mechanism to re-activate the report on user login

Changed

  • Switched from docxtpl to a Ghostwriter fork to implement performance improvements (Fixes Large Observation results in High Load #585; Closes [Task] Identify a Path Forward for Docx Dependencies #822)
    • Implemented changes in the upstream docxtpl development branch
    • Will consider returning to using the Pypi package when the new maintainers are able to merge the development changes and begin tagging releases
  • Updated Django to v5.2 with groundwork completed for Django v6.x (Closes Django 4.2 LTS reaches EOL in April #824)
    • Going slow with version upgrades to ensure there are no issues with dependencies
  • The dashboard calendar will now show all projects accessible to the user (Closes [Feature] Overview calendar for managers #871)
    • For most users, the calendar will not appear to have changed, except for now including more details
    • For managers and others with access to more projects, they will now be able to see how all their projects relate to each other in the calendar

Fixed

  • Adjusted how the TinyMCE editors load to fix pages sometimes scrolling down to newly initialized TinyMCE fields

Copilot AI review requested due to automatic review settings June 5, 2026 23:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a57532a4f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ghostwriter/static/js/tinymce/config.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades Ghostwriter’s backend stack to Django 5.2 (and related dependency updates) and includes supporting changes across templates, health checks, tests, and CI to maintain functionality and reduce drift between backend schema and generated frontend GraphQL types.

Changes:

  • Upgrade Django and core dependencies (incl. allauth MFA, crispy-forms, health checks, docx tooling) and adjust code/migrations/settings accordingly.
  • Add a CI workflow to verify committed GraphQL codegen output is up-to-date when models/migrations/Hasura metadata change.
  • Improve UI behavior: dashboard calendar now receives server-built event JSON, active report selection persists across sessions, tabs/TinyMCE initialization updated for better UX.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
requirements/production.txt Bumps production-only dependencies (gunicorn, django-anymail).
requirements/local.txt Updates dev/test tooling versions (mypy, pytest, coverage, debug toolbar, etc.).
requirements/base.txt Upgrades Django + core libs; switches docxtpl to fork; adds crispy-bootstrap4; updates health-check deps.
README.md Updates Django badge to 5.2.
ghostwriter/users/tests/test_views.py Adds MFA email-verification guard tests and uses override_settings.
ghostwriter/templates/tab-link.html Updates tab link markup to support stable URL hashes + separate pane targets.
ghostwriter/templates/mfa/index.html Updates MFA page layout classes for improved responsiveness.
ghostwriter/templates/index.html Moves calendar event data into json_script and consumes it in FullCalendar.
ghostwriter/templates/base_generic.html Adds localStorage-backed “active report” restore + tab hash targeting updates.
ghostwriter/templates/base_generic_empty.html Mirrors active-report persistence + tab hash targeting for the empty layout.
ghostwriter/templates/account/password_change.html Adds breadcrumbs block for password change page.
ghostwriter/templates/account/email.html Adds breadcrumbs block for email management page.
ghostwriter/status/views.py Migrates health check view implementation to HealthCheckView and explicit check list.
ghostwriter/status/templates/health_check.html Updates health check template to render new status_results structure.
ghostwriter/status/migrations/0001_drop_legacy_health_check_db_table.py Adds migration to drop legacy health-check DB table/metadata.
ghostwriter/status/apps.py Removes plugin registration hook for Hasura health check (now explicitly listed in view).
ghostwriter/static/js/tinymce/config.js Refactors TinyMCE init to avoid page scroll jumps and lazily init in tabs/modals.
ghostwriter/static/css/styles.css Adds MFA card/action button styling helpers.
ghostwriter/shepherd/tests/test_views.py Fixes invalid IPs used in duplicate-server test.
ghostwriter/shepherd/tests/test_forms.py Stabilizes domain factory test data (names/statuses) for checkout tests.
ghostwriter/shepherd/models.py Updates CheckConstraint arg to condition= for Django 5.x.
ghostwriter/rolodex/tests/test_views.py Adds tests asserting initial active tab selection using BeautifulSoup.
ghostwriter/rolodex/templates/rolodex/project_form.html Updates formset TinyMCE init to use new global init helper.
ghostwriter/rolodex/models.py Updates CheckConstraint arg to condition= for Django 5.x.
ghostwriter/rolodex/admin.py Updates list display to use tag_list helper.
ghostwriter/reporting/tests/test_views.py Updates queryset assertion helper name for Django 5.x.
ghostwriter/reporting/tests/test_models.py Adds regression test for docx lint initialization order with forked docxtpl.
ghostwriter/reporting/models.py Updates “Untitled …” display strings and updates a constraint to condition=.
ghostwriter/reporting/migrations/0007_auto_20200110_0505.py Removes tinymce dependency from historical migration field definition.
ghostwriter/reporting/migrations/0006_auto_20191122_2304.py Removes tinymce dependency from historical migration field definitions.
ghostwriter/oplog/migrations/0001_initial.py Removes tinymce dependency from historical migration field definition.
ghostwriter/modules/reportwriter/base/docx.py Adjusts docx style access for forked docxtpl API.
ghostwriter/modules/health_utils.py Updates Hasura health check implementation to new django-health-check API and adds timeouts.
ghostwriter/modules/custom_layout_object.py Updates crispy layout object signatures and introduces stable tab hash/id behavior.
ghostwriter/home/views.py Adds server-side calendar event builder using RBAC-aware project selection.
ghostwriter/home/tests/test_views.py Expands dashboard tests for calendar visibility across roles/invites.
ghostwriter/factories.py Fixes timezone import shadowing by aliasing datetime.timezone.
ghostwriter/commandcenter/models.py Updates CheckConstraint arg to condition= for Django 5.x.
ghostwriter/api/models.py Updates CheckConstraint args to condition= for Django 5.x.
config/settings/base.py Updates installed apps (crispy-bootstrap4, health_check changes), removes legacy settings, adds MFA allow-unverified toggle.
compose/local/django/Dockerfile Updates pip bootstrap step to upgrade setuptools + pip.
CHANGELOG.md Adds 7.1.0 changelog entry describing the upgrade and feature changes.
.github/workflows/graphql-codegen.yml Adds workflow to validate committed GraphQL generated sources are in sync.

Comment thread ghostwriter/status/views.py
Comment thread ghostwriter/status/migrations/0001_drop_legacy_health_check_db_table.py Outdated
Comment thread config/settings/base.py
Comment thread requirements/base.txt Outdated
@augmentcode

augmentcode Bot commented Jun 5, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Upgrades Ghostwriter to Django 5.2 and refreshes the dependency stack, with supporting changes across health checks, forms, migrations, and UI.

Changes:

  • Updated core dependencies (Django 5.2, crispy-forms 2.x + crispy-bootstrap4, allauth[mfa], django-health-check 4.x, channels/redis, etc.).
  • Added a GitHub Actions workflow to verify GraphQL code generation output stays in sync with model/metadata changes.
  • Reworked the dashboard calendar to render ongoing projects from server-provided JSON (including privileged users seeing all ongoing projects) and added coverage for the new behavior.
  • Improved TinyMCE initialization to lazily initialize editors in tabs/modals and prevent initial scroll jumps; updated the project form to use the new initializer.
  • Persisted the “active report” selection in browser localStorage and restored it on login to re-activate the report automatically.
  • Modernized the status/health page to use django-health-check’s async HealthCheckView with explicit Redis/Hasura checks and updated the template rendering.
  • Removed legacy django-tinymce migration dependencies by switching historical migrations from HTMLField to TextField equivalents.
  • Applied Django 5.2 compatibility updates (e.g., CheckConstraint `condition=`, updated test assertions, minor admin/model tweaks).

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread config/settings/base.py Outdated
Comment thread ghostwriter/status/migrations/0001_drop_legacy_health_check_db_table.py Outdated
Comment thread ghostwriter/templates/index.html
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.51724% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.77%. Comparing base (d160ab4) to head (4099506).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
ghostwriter/status/views.py 61.53% 5 Missing ⚠️
ghostwriter/reporting/models.py 0.00% 3 Missing ⚠️
ghostwriter/home/views.py 94.11% 2 Missing ⚠️
ghostwriter/users/tests/test_views.py 89.47% 2 Missing ⚠️
ghostwriter/reporting/views2/report.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #900      +/-   ##
==========================================
+ Coverage   93.61%   93.77%   +0.15%     
==========================================
  Files         404      406       +2     
  Lines       27687    27951     +264     
==========================================
+ Hits        25920    26210     +290     
+ Misses       1767     1741      -26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

These changes resolve a deprecation warning for `allauth` with the Django and app upgrades. It also fixes a 500 error that could occur when the auth service fails for some reason—e.g., a Microsoft Entra ID secret has expired or is invalid.
The migration now only drops the legacy health-check table and no longer modifies django_migrations.
These changes address a flash or flicker that could occur when adding formsets to a form. The init of TinyMCE caused this behavior along with some fade in/output animation this was doing to indicate the new formset. New formset fields not glow green for a short time after addition.
Added a scroll after a brief delay to let layout settle. Now scrolls down when a newly added formset is out of view.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 59 out of 59 changed files in this pull request and generated 6 comments.

Comment thread ghostwriter/modules/custom_layout_object.py
Comment thread ghostwriter/status/views.py
Comment thread ghostwriter/modules/health_utils.py
Comment thread ghostwriter/status/templates/health_check.html
Comment thread ghostwriter/status/templates/health_check.html
Comment thread config/settings/base.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants