Add configuration for renamed field module paths.

Review Request #13698 — Created April 4, 2024 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

In some cases, field classes may be renamed or moved to different
modules. django-evolution had some one-off logic to handle this for when
django itself moved all the fields from django.db.models.fields to
django.db.models, but there was nothing available to consumers of the
library to do the same.

We recently ran into a problem where we decided to remove a dependency
on a third-party field, replacing it with a compatible home-grown
implementation. This worked fine, except django-evolution would fail to
load the signature because the old module didn't exist. This change adds
a new mapping to the django-evolution configuration,
RENAMED_FIELD_TYPES, which allows a project to define their own
renames.

  • Used this in conjunction with code that set
    DJANGO_EVOLUTION['RENAMED_FIELD_TYPES'] to a mapping from our old
    third-party library to our new implementation, and saw that
    django-evolution management commands and Evolver calls worked
    correctly.
  • Ran unit tests.

Commits

Files