Add configuration for renamed field module paths.

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

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.
Summary ID
Add configuration for renamed field module paths.
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. Testing Done: - 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.
c98f7b06e3193b1c95b74a0215d30a0ce2af04c6
Description From Last Updated

This needs a Version Added.

chipx86chipx86
chipx86
  1. 
      
  2. django_evolution/conf.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    This needs a Version Added.

  3. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.x (fc2b9a5)
Loading...