Skip to content

build: upgrade to Django 5.2 and django-cms 4.x#2202

Draft
alextreme wants to merge 5 commits intodevelopfrom
feature/django-5.2-upgrade
Draft

build: upgrade to Django 5.2 and django-cms 4.x#2202
alextreme wants to merge 5 commits intodevelopfrom
feature/django-5.2-upgrade

Conversation

@alextreme
Copy link
Member

@alextreme alextreme commented Feb 6, 2026

Branch created with Claude / Opus, still requires review from my end:

  • Update Django from 4.2.x to 5.2.x
  • Upgrade django-cms from 3.11.x to 4.1.x for Django 5.2 compatibility
  • Add djangocms-versioning for CMS 4.x publishing workflow
  • Add djangocms-text for CMS 4.x text plugin
  • Update djangocms-link and djangocms-picture to CMS 4.x compatible versions

Breaking changes addressed:

  • Remove deprecated USE_L10N setting (removed in Django 5.0)
  • Remove deprecated default_app_config from init.py files
  • Replace Title model with PageContent for CMS 4.x
  • Remove publisher_is_draft field usage (CMS 4.x uses versioning)
  • Update page.languages to settings.LANGUAGE_CODE
  • Update template filtering for CMS 4.x (template now on PageContent)

Files updated for CMS 4.x compatibility:

  • core/views.py: Use PageContent instead of Title
  • cms/utils/page_display.py: Remove publisher_is_draft filtering
  • cms/footer/cms_plugins.py: Update template query
  • components/templatetags/menu.py: Remove draft/public page logic
  • configurations/tests/bootstrap/_test_setup_cms.py: Update test queries

Note: Existing CMS content will need migration using djangocms-4-migration tool.

Co-Authored-By: Claude

Summary

Issue References

  • Taiga User Story:
  • Taiga Issue:
  • Taiga Dimpact Issue:
  • Github Issue:

Checklist

  • CHANGELOG.rst updated
    • Deployment notes added
    • Breaking changes flagged
  • Documentation updated
  • Codecov report reviewed for untested lines
  • Storybook component updated/created
  • Vitest tests added/updated
  • Updated the docker-compose.yml environment variables

@alextreme alextreme force-pushed the feature/django-5.2-upgrade branch 18 times, most recently from 9af67f0 to 30a5f90 Compare February 8, 2026 22:12
alextreme and others added 2 commits February 9, 2026 00:07
This commit upgrades the project from Django 4.2.x to Django 5.2 and
from django-cms 3.11.x to django-cms 4.x with djangocms-versioning.

Key changes:

**Django 5.2 compatibility:**
- Logout now requires POST instead of GET
- User.objects.make_random_password() removed - use secrets module
- Form field choices return tuples instead of lists

**CMS 4.x with djangocms-versioning:**
- Page.is_published() removed - use Version model to check state
- page.publish() removed - use versioning API via _publish_page() helper
- api.create_page() requires created_by parameter for version creation
- Placeholders are on PageContent, not Page
- Use PageContent.admin_manager to access draft content

**Test infrastructure:**
- Added cms_tools helpers: _cleanup_cms_test_user(), user_queryset()
- Updated OIDC tests to exclude CMS system user from counts
- Fixed menu tests for CMS 4.x versioning behavior
- Added data migration for ExtendedCMSLink link field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move CMS versioning helpers from utils.py to utils/__init__.py to fix
ImportError. Python's import system treats the directory as a package
and ignores the file, causing the `has_published_apphook` import to fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@alextreme alextreme force-pushed the feature/django-5.2-upgrade branch from 30a5f90 to 33e864c Compare February 8, 2026 23:22
alextreme and others added 3 commits February 9, 2026 00:37
The MaybeEncodingError in Django 5.x's parallel test runner occurs when
structlog's BoundLogger objects (which can't be pickled) are included in
test results that need to be serialized between processes.

This fix:
- Sets LOG_REQUESTS=no to disable django_structlog middleware in CI
- Reconfigures structlog with cache_logger_on_first_use=False to prevent
  caching of loggers that could contain unpicklable state

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Python's structural pattern matching doesn't work correctly with
Django's TextChoices enums. The match statement was returning None
instead of the expected logout URLs because the pattern matching
comparison mechanism differs from regular equality checks.

Using if/elif with explicit equality comparisons ensures correct
behavior when comparing the string value stored in the database
with TextChoices enum members.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Install tblib.pickling_support early in CI settings to enable
pickling of traceback objects. This prevents MaybeEncodingError
when running tests in parallel and a test failure occurs, as the
traceback objects containing local function references can now
be properly serialized between processes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments