-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #631 from edx/aj/ENT-2082_enroll_task
[ENT-2082] Added Source to the enterprise enrollment background task
- Loading branch information
Showing
6 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
enterprise/migrations/0081_UpdateEnterpriseEnrollmentSource.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.25 on 2019-10-24 11:00 | ||
from __future__ import unicode_literals | ||
|
||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
import model_utils.fields | ||
|
||
ORIGINAL_SOURCE_NAME = 'Enterprise User B2C Site Enrollment' | ||
ORIGINAL_SOURCE_SLUG = 'b2c_site' | ||
UPDATED_SOURCE_NAME = 'Enterprise User Enrollment Background Task' | ||
UPDATED_SOURCE_SLUG = 'enrollment_task' | ||
|
||
|
||
def update_source(apps, schema_editor): | ||
""" | ||
The name of this Source is being updated to better reflect it usage. | ||
""" | ||
enrollment_sources = apps.get_model('enterprise', 'EnterpriseEnrollmentSource') | ||
|
||
source = enrollment_sources.objects.get(slug=ORIGINAL_SOURCE_SLUG) | ||
source.name = UPDATED_SOURCE_NAME | ||
source.slug = UPDATED_SOURCE_SLUG | ||
source.save() | ||
|
||
|
||
def revert_source(apps, schema_editor): | ||
""" | ||
The name of this Source is being updated to better reflect it usage. | ||
""" | ||
enrollment_sources = apps.get_model('enterprise', 'EnterpriseEnrollmentSource') | ||
|
||
source = enrollment_sources.objects.get(slug=UPDATED_SOURCE_SLUG) | ||
source.name = ORIGINAL_SOURCE_NAME | ||
source.slug = ORIGINAL_SOURCE_SLUG | ||
source.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('enterprise', '0079_AddEnterpriseEnrollmentSource'), | ||
('enterprise', '0080_auto_20191113_1708'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_source, revert_source) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters