fix: key=0 修改到 key=1 时 parent_key 没有更新

pull/5972/head
xinwen 2021-04-15 14:28:26 +08:00 committed by 老广
parent 2b31cb2806
commit f146873501
1 changed files with 2 additions and 0 deletions

View File

@ -42,7 +42,9 @@ def change_key0_to_key1(apps, schema_editor):
key_list = n.key.split(':')
key_list[0] = '1'
new_key = ':'.join(key_list)
new_parent_key = ':'.join(key_list[:-1])
n.key = new_key
n.parent_key = new_parent_key
n.save()
print('--> Modify key ( {} > {} )'.format(old_key, new_key))