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
评论列表
文章目录