Django: Providing initial group with migrations

半腔热情 提交于 2019-12-06 04:10:09

Permissions are created when the post_migrate signal fires. This signal is only fired if all migrations in the current run are completed. You cannot depend on the permissions existing within your migration.

The signal receiver that creates the permissions checks for existing permissions, so you can simply create the permission yourself if it doesn't exist yet.

It would also be good to add a dependency on ('auth', '__latest__') to ensure that the migrations for the Permission model have run and at least the table exists.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!