2
0

0001_initial.py 821 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import models, migrations
  4. def add_book(apps, schema_editor):
  5. apps.get_model("migration_test_data_persistence", "Book").objects.using(
  6. schema_editor.connection.alias,
  7. ).create(
  8. title="I Love Django",
  9. )
  10. class Migration(migrations.Migration):
  11. dependencies = [
  12. ]
  13. operations = [
  14. migrations.CreateModel(
  15. name='Book',
  16. fields=[
  17. ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
  18. ('title', models.CharField(max_length=100)),
  19. ],
  20. options={
  21. },
  22. bases=(models.Model,),
  23. ),
  24. migrations.RunPython(
  25. add_book,
  26. ),
  27. ]