[Update] 更新迁移脚本

pull/1197/head
ibuler 7 years ago
parent ee4f5a8194
commit 8dfdefd428

@ -3,6 +3,7 @@
python ../apps/manage.py shell << EOF python ../apps/manage.py shell << EOF
from perms.models import * from perms.models import *
from assets.models import SystemUser
for old in NodePermission.objects.all(): for old in NodePermission.objects.all():
perm = AssetPermission.objects.create( perm = AssetPermission.objects.create(
@ -20,5 +21,10 @@ for old in NodePermission.objects.all():
perm.user_groups.add(old.user_group) perm.user_groups.add(old.user_group)
perm.nodes.add(old.node) perm.nodes.add(old.node)
perm.system_users.add(old.system_user) perm.system_users.add(old.system_user)
for s in SystemUser.objects.all():
nodes = list(s.nodes.all())
s.nodes.set([])
s.nodes.set(nodes)
EOF EOF

Loading…
Cancel
Save