About Idempotent Data Migrations

Django data migrations must be idempotent, meaning they should not rely on external functions that use the current state of models.

This is because historical fields may not match the present structure, causing external functions to fail.

The best way to avoid this issue is to replicate the logic of the external function within the migration itself.

Tips and Tricks Programming Development Django 5.x Django 4.2 Django 3.2