Don't make the default organization name hardcoded.

This commit is contained in:
Roberto Rosario
2016-05-25 02:44:24 -04:00
parent 7be1d76f62
commit 2ca3a67c9c
2 changed files with 4 additions and 1 deletions

View File

@@ -5,3 +5,4 @@ DEFAULT_ORGANIZATION_ADMIN_EMAIL = 'oadmin@example.com'
DEFAULT_ORGANIZATION_ADMIN_PASSWORD = None
DEFAULT_ORGANIZATION_ADMIN_ROLE = 'Organization admins'
DEFAULT_ORGANIZATION_ADMIN_USERNAME = 'oadmin'
DEFAULT_ORGANIZATION_LABEL = 'Default'

View File

@@ -3,12 +3,14 @@ from __future__ import unicode_literals
from django.db import migrations, models
from ..literals import DEFAULT_ORGANIZATION_LABEL
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(label='Default')
default_organization = Organization(label=DEFAULT_ORGANIZATION_LABEL)
default_organization.save()