class RunPython(code, reverse_code=None, atomic=None, hints=None, elidable=False) [source]
Runs custom Python code in a historical context. code (and reverse_code if supplied) should be callable objects that accept two arguments; the first is an instance of django.apps.registry.Apps containing historical models that match the operation’s place in the project history, and the second is an instance of SchemaEditor.
The reverse_code argument is called when unapplying migrations. This callable s