Add data migration for organizations apps and change documents migration 35 dependencies to this new migration
This commit is contained in:
committed by
Roberto Rosario
parent
14bd599387
commit
ab69031662
@@ -8,8 +8,8 @@ import organizations.shortcuts
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('organizations', '0001_initial'),
|
||||
('documents', '0033_auto_20160325_0052'),
|
||||
('organizations', '0002_add_data_default_organization'),
|
||||
('documents', '0034_auto_20160509_2321'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def default_data(apps, schema_editor):
|
||||
# We can't import the Organization model directly as it may be a newer
|
||||
# version than this migration expects. We use the historical version.
|
||||
Organization = apps.get_model("organizations", "Organization")
|
||||
default_organization = Organization(id=1, label='Default')
|
||||
default_organization.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('organizations', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(default_data),
|
||||
]
|
||||
Reference in New Issue
Block a user