1
0
mirror of https://github.com/django/django.git synced 2025-01-03 06:55:47 +00:00

Refs #23528 -- Made cosmetic edits to swappable_dependency() docs.

This commit is contained in:
Mariusz Felisiak 2023-06-03 11:01:15 +01:00 committed by GitHub
parent 7d96ce68ae
commit 1136aa5005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,14 +224,14 @@ Swappable dependencies
.. function:: django.db.migrations.swappable_dependency(value) .. function:: django.db.migrations.swappable_dependency(value)
The ``swappable_dependency()`` function is used in migrations to declare The ``swappable_dependency()`` function is used in migrations to declare
"swappable" dependencies on migrations in the app of the swapped-in model. "swappable" dependencies on migrations in the app of the swapped-in model,
Currently, the first migration of this app and as a consequence the swapped-in currently, on the first migration of this app. As a consequence, the swapped-in
model should be created in the initial migration. The argument ``value`` is a model should be created in the initial migration. The argument ``value`` is a
string ``"<app label>.<model>"`` describing an app label and a model name, e.g. string ``"<app label>.<model>"`` describing an app label and a model name, e.g.
``"myapp.MyModel"``. ``"myapp.MyModel"``.
By using ``swappable_dependency()``, you inform the migration framework that By using ``swappable_dependency()``, you inform the migration framework that
the migration relies on a migration which sets up up a swappable model, the migration relies on another migration which sets up a swappable model,
allowing for the possibility of substituting the model with a different allowing for the possibility of substituting the model with a different
implementation in the future. This is typically used for referencing models implementation in the future. This is typically used for referencing models
that are subject to customization or replacement, such as the custom user that are subject to customization or replacement, such as the custom user