-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ddd168
commit 104c2a2
Showing
4 changed files
with
45 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
from django.db import migrations | ||
|
||
from waffle.models import Switch | ||
|
||
# The name of the switch must be unique. | ||
SWITCH_NAME = "M24_HERO_ANIMATION" | ||
|
||
|
||
def create_switch(apps, schema_editor): | ||
Switch.objects.get_or_create( | ||
name=SWITCH_NAME, | ||
defaults={"active": False}, # Set initial state, True or False. | ||
) | ||
|
||
|
||
def remove_switch(apps, schema_editor): | ||
Switch.objects.filter(name=SWITCH_NAME).delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
( | ||
"base", | ||
"0001_initial", | ||
), # Keep whatever the makemigrations command generated here. | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_switch, remove_switch), | ||
] |
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