usermixin.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:websauna 作者: websauna 项目源码 文件源码
def check_empty_site_init(self, dbsession:Session, user:UserMixin):
        """Call after user creation to see if this user is the first user and should get initial admin rights."""

        assert user.id, "Please flush your db"

        # Try to reflect related group class based on User model
        i = inspection.inspect(user.__class__)
        Group = i.relationships["groups"].mapper.entity

        # If we already have groups admin group must be there
        if dbsession.query(Group).count() > 0:
            return

        self.init_empty_site(dbsession, user)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号