Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.7.x] Fixed #23296 -- Fixed RunPython code sample in Migration Oper…


Backport of 7ca665c from master
  • Loading branch information...
commit 28d97533246fa1051e416ff772a40190b1f30e4d 1 parent 41cf159
@areski areski authored timgraham committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 docs/ref/migration-operations.txt
6 docs/ref/migration-operations.txt
@@ -219,8 +219,10 @@ model::
# if we directly import it, it'll be the wrong version
Country = apps.get_model("myapp", "Country")
db_alias = schema_editor.connection.alias
- Country.objects.create(name="USA", code="us", using=db_alias)
- Country.objects.create(name="France", code="fr", using=db_alias)
+ Country.objects.using(db_alias).bulk_create([
+ Country(name="USA", code="us"),
+ Country(name="France", code="fr"),
+ ])
class Migration(migrations.Migration):
Please sign in to comment.
Something went wrong with that request. Please try again.