Add support for Django 4.2 in Djblets 5.

Review Request #13427 — Created Nov. 21, 2023 and submitted

Information

Djblets
release-5.x

Reviewers

Djblets 5 is based on Django 4.2 LTS, which has an End Of Life date of
April 1, 2026, and will be the last scheduled LTS release until
mid-2025.

There are a handful of issues that needed to be fixed in order to
support Django 4.2, but they're all pretty minor. Some of these could
even be backported to earlier releases.

The following changes are made:

  1. The _clone_q() utility method no longer worked. It's been updated
    to do a deepcopy, which is now supported by Q() objects.

  2. The Conditions field widget tests had to be updated for changes to
    form field HTML.

  3. App and model management in TestModelsLoaderMixin had to have some
    tweaks to avoid making some assumptions and to ensure population of
    new installed apps.

  4. mark_safe_lazy() had the wrong type mapped for results. This didn't
    impact anything seriously before, but Django is now more sensitive to
    it. This could be backported, but won't be just to ensure there are
    no unforeseen regressions.

  5. pytz.utc generated warnings in a unit test. We now use Django's
    utc.

  6. Some tests_app values were old and incorrect. They didn't break
    anything before, but Django's more strict now about mappings. These
    have been removed in order to use the correct default module for the
    models.

There are other fixes that will be coming for datetime/timezone imports
and staticfiles storage API. These currently generate warnings, but
otherwise work as before. We'll fix them to future-proof early in order
to ease testing with Django 5 down the road.

Installed in a new virtualenv and tested against all supported versions
of Python. All tests pass.

Summary ID
Add support for Django 4.2 in Djblets 5.
Djblets 5 is based on Django 4.2 LTS, which has an End Of Life date of April 1, 2026, and will be the last scheduled LTS release until mid-2025. There are a handful of issues that needed to be fixed in order to support Django 4.2, but they're all pretty minor. Some of these could even be backported to earlier releases. The following changes are made: 1. The `_clone_q()` utility method no longer worked. It's been updated to do a deepcopy, which is now supported by `Q()` objects. 2. The Conditions field widget tests had to be updated for changes to form field HTML. 3. App and model management in `TestModelsLoaderMixin` had to have some tweaks to avoid making some assumptions and to ensure population of new installed apps. 4. `mark_safe_lazy()` had the wrong type mapped for results. This didn't impact anything seriously before, but Django is now more sensitive to it. This could be backported, but won't be just to ensure there are no unforeseen regressions. 5. `pytz.utc` generated warnings in a unit test. We now use Django's `utc`. 6. Some `tests_app` values were old and incorrect. They didn't break anything before, but Django's more strict now about mappings. These have been removed in order to use the correct default module for the models. There are other fixes that will be coming for datetime/timezone imports and staticfiles storage API. These currently generate warnings, but otherwise work as before. We'll fix them to future-proof early in order to ease testing with Django 5 down the road.
6f8c8c6cbecba4a5de24aa44007841e79132313a
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (d27613e)