mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-21 19:38:07 +00:00
[Update] 修正migrations
This commit is contained in:
@@ -4,14 +4,6 @@ from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
def add_default_actions(apps, schema_editor):
|
||||
from ..const import PERMS_ACTION_NAME_CHOICES
|
||||
action_model = apps.get_model('perms', 'Action')
|
||||
db_alias = schema_editor.connection.alias
|
||||
for action, _ in PERMS_ACTION_NAME_CHOICES:
|
||||
action_model.objects.using(db_alias).update_or_create(name=action)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
@@ -29,5 +21,4 @@ class Migration(migrations.Migration):
|
||||
'verbose_name': 'Action',
|
||||
},
|
||||
),
|
||||
migrations.RunPython(add_default_actions)
|
||||
]
|
||||
|
Reference in New Issue
Block a user