Fixed #23296 -- Fixed RunPython code sample in Migration Operations.
This commit is contained in:
parent
1d79d08d9a
commit
7ca665c5f5
|
@ -219,8 +219,10 @@ model::
|
||||||
# if we directly import it, it'll be the wrong version
|
# if we directly import it, it'll be the wrong version
|
||||||
Country = apps.get_model("myapp", "Country")
|
Country = apps.get_model("myapp", "Country")
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
Country.objects.create(name="USA", code="us", using=db_alias)
|
Country.objects.using(db_alias).bulk_create([
|
||||||
Country.objects.create(name="France", code="fr", using=db_alias)
|
Country(name="USA", code="us"),
|
||||||
|
Country(name="France", code="fr"),
|
||||||
|
])
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue