-
Notifications
You must be signed in to change notification settings - Fork 140
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 #774 from intuitem/model/appliec-control-status-ch…
…oices Update AppliedControl status choices
- Loading branch information
Showing
15 changed files
with
213 additions
and
81 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
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
45 changes: 45 additions & 0 deletions
45
backend/core/migrations/0023_alter_appliedcontrol_status.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,45 @@ | ||
# Generated by Django 5.1 on 2024-08-29 13:41 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def update_status(apps, schema_editor): | ||
AppliedControl = apps.get_model("core", "AppliedControl") | ||
for control in AppliedControl.objects.all(): | ||
if control.status == "planned": | ||
control.status = "to_do" | ||
control.save() | ||
elif control.status == "inactive": | ||
control.status = "deprecated" | ||
control.save() | ||
elif control.status is None: | ||
control.status = "--" | ||
control.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0022_riskscenario_qualifications"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="appliedcontrol", | ||
name="status", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("to_do", "To do"), | ||
("in_progress", "In progress"), | ||
("active", "Active"), | ||
("on_hold", "On hold"), | ||
("deprecated", "Deprecated"), | ||
("--", "Undefined"), | ||
], | ||
default="--", | ||
max_length=20, | ||
verbose_name="Status", | ||
), | ||
), | ||
migrations.RunPython(update_status), | ||
] |
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.