-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: merge AppP and ModC body roles
- Remove the AppP body role - Rename the ModC body role - Replace all occurences of AppP with ModC - Migrate all records in DB that refereced AppP to now use ModC
- Loading branch information
Showing
5 changed files
with
51 additions
and
13 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
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,40 @@ | ||
# Generated by Django 3.2.16 on 2023-12-16 12:02 | ||
|
||
from django.db import migrations | ||
import multiselectfield.db.fields | ||
|
||
|
||
def migrate_AppP_role_to_ModC_role(apps, schema_editor): | ||
BodyRole = apps.get_model("roles", "BodyRole") | ||
|
||
for obj in BodyRole.objects.filter(permissions__contains="AppP"): | ||
obj.permissions.remove("AppP") | ||
if "ModC" not in obj.permissions: | ||
obj.permissions.append("ModC") | ||
obj.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("roles", "0021_delete_communityrole"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="bodyrole", | ||
name="permissions", | ||
field=multiselectfield.db.fields.MultiSelectField( | ||
choices=[ | ||
("AddE", "Add Event"), | ||
("UpdE", "Update Event"), | ||
("DelE", "Delete Event"), | ||
("UpdB", "Update Body"), | ||
("Role", "Modify Roles"), | ||
("VerA", "Verify Achievements"), | ||
("ModC", "Moderate Community"), | ||
], | ||
max_length=34, | ||
), | ||
), | ||
migrations.RunPython(migrate_AppP_role_to_ModC_role), | ||
] |
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