-
Notifications
You must be signed in to change notification settings - Fork 148
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 #1726 from Bidaya0/fix/upgrade_data_to_1.14.0
fix:data update
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 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,26 @@ | ||
# Generated by Django 3.2.20 on 2023-08-14 15:37 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def update_role_permission(apps, schema_editor): | ||
# We can't import the Person model directly as it may be a newer | ||
# version than this migration expects. We use the historical version. | ||
User = apps.get_model("dongtai_common", "User") | ||
for user in User.objects.all(): | ||
if user.pk == 1: | ||
user.role_id = 1 | ||
user.is_global_permission = True | ||
else: | ||
user.role_id = 2 | ||
user.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("dongtai_common", "0010_auto_20230809_1838"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_role_permission), | ||
] |