-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StatementTypeEnum fixes. Closes #1643
Set all `StatementTypeEnum.<LABEL>.value` to `StatementTypeEnum.<LABEL>.name` in order for relevant label/term to show up in Django database admin interface. Set component library detail page Systems tab to not be inactive thereby removing the content from the System tab showing up on the Control Implementation Statements tab. Update controls.tests.
- Loading branch information
1 parent
13d5d1c
commit 13c8a00
Showing
10 changed files
with
147 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Generated by Django 3.1.8 on 2021-06-29 23:28 | ||
|
||
from django.db import migrations | ||
from controls.enums.statements import StatementTypeEnum | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('controls', '0051_auto_20210520_1213'), | ||
] | ||
|
||
def update_statement_type_to_enum_name(apps, schema_editor): | ||
"""Update the statement_type values to use enum 'name' instead of enum 'value'""" | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION.value)\ | ||
.update(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION_LEGACY.value)\ | ||
.update(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION_LEGACY.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION_PROTOTYPE.value)\ | ||
.update(statement_type=StatementTypeEnum.CONTROL_IMPLEMENTATION_PROTOTYPE.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.ASSESSMENT_RESULT.value)\ | ||
.update(statement_type=StatementTypeEnum.ASSESSMENT_RESULT.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.POAM.value)\ | ||
.update(statement_type=StatementTypeEnum.POAM.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.FISMA_IMPACT_LEVEL.value)\ | ||
.update(statement_type=StatementTypeEnum.FISMA_IMPACT_LEVEL.name) | ||
|
||
apps.get_model("controls", "Statement")\ | ||
.objects\ | ||
.filter(statement_type=StatementTypeEnum.SECURITY_IMPACT_LEVEL.value)\ | ||
.update(statement_type=StatementTypeEnum.SECURITY_IMPACT_LEVEL.name) | ||
|
||
operations = [ | ||
migrations.RunPython(update_statement_type_to_enum_name), | ||
] |
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.