google_models.py 文件源码

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

项目:beg-django-e-commerce 作者: Apress 项目源码 文件源码
def get_djangouser_for_user(cls, user):
        django_user = cls.all().filter('user =', user).get()
        if django_user:
            if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True):
                is_admin = users.is_current_user_admin()
                if django_user.is_staff != is_admin or \
                        django_user.is_superuser != is_admin:
                    django_user.is_superuser = django_user.is_staff = is_admin
                    django_user.put()
        else:
            django_user = cls.create_djangouser_for_user(user)
            django_user.is_active = True
            if getattr(settings, 'AUTH_ADMIN_USER_AS_SUPERUSER', True) and \
                    users.is_current_user_admin():
                django_user.is_staff = True
                django_user.is_superuser = True
            django_user.put()
        return django_user
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号