-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jls/b5-web-apps
- Loading branch information
Showing
71 changed files
with
3,335 additions
and
1,688 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
44 changes: 44 additions & 0 deletions
44
corehq/apps/accounting/migrations/0095_update_softwareplan_visibilities.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,44 @@ | ||
from datetime import datetime | ||
|
||
from django.db import migrations, models | ||
|
||
from corehq.apps.accounting.models import SoftwarePlanVisibility | ||
|
||
ANNUAL = "ANNUAL" | ||
|
||
|
||
def change_plan_visibilities(apps, schema_editor): | ||
# one-time cleanup of existing software plans | ||
SoftwarePlan = apps.get_model('accounting', 'SoftwarePlan') | ||
|
||
enterprise_names = ["Dimagi Only CommCare Enterprise Edition"] | ||
enterprise_plans = SoftwarePlan.objects.filter(name__in=enterprise_names) | ||
enterprise_plans.update(visibility=SoftwarePlanVisibility.INTERNAL, last_modified=datetime.now()) | ||
|
||
annual_plans = SoftwarePlan.objects.filter(visibility=ANNUAL) | ||
annual_plans.update(visibility=SoftwarePlanVisibility.PUBLIC, last_modified=datetime.now()) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("accounting", "0094_add_annual_softwareplans"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(change_plan_visibilities), | ||
migrations.AlterField( | ||
model_name="softwareplan", | ||
name="visibility", | ||
field=models.CharField( | ||
choices=[ | ||
("PUBLIC", "PUBLIC - Anyone can subscribe"), | ||
("INTERNAL", "INTERNAL - Dimagi must create subscription"), | ||
("TRIAL", "TRIAL- This is a Trial Plan"), | ||
("ARCHIVED", "ARCHIVED - hidden from subscription change forms"), | ||
], | ||
default="INTERNAL", | ||
max_length=10, | ||
), | ||
), | ||
] |
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
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
Oops, something went wrong.