django_evolution.mutations.rename_model
Mutation that renames a model.
New in version 2.2.
Classes
|
A mutation that renames a model. |
- class django_evolution.mutations.rename_model.RenameModel(old_model_name, new_model_name, db_table)
Bases:
BaseModelMutation
A mutation that renames a model.
Changed in version 2.2: Moved into the
django_evolution.mutations.rename_model
module.- simulation_failure_error = 'Cannot rename the model "%(app_label)s.%(model_name)s".'
- __init__(old_model_name, new_model_name, db_table)
Initialize the mutation.
- get_hint_params()
Return parameters for the mutation’s hinted evolution.
- simulate(simulation)
Simulate the mutation.
This will alter the database schema to rename the specified model.
- Parameters:
simulation (
Simulation
) – The state for the simulation.- Raises:
django_evolution.errors.SimulationFailure – The simulation failed. The reason is in the exception’s message.
- mutate(mutator, model)
Schedule a model rename on the mutator.
This will instruct the mutator to rename a model. It will be scheduled and later executed on the database, if not optimized out.
- Parameters:
mutator (
django_evolution.mutators.ModelMutator
) – The mutator to perform an operation on.model (
MockModel
) – The model being mutated.