本文整理汇总了Python中flaskbb.user.models.User类的典型用法代码示例。如果您正苦于以下问题:Python User类的具体用法?Python User怎么用?Python User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: super_moderator_user
def super_moderator_user(default_groups):
"""Creates a super moderator user."""
user = User(username="test_super_mod", email="[email protected]",
password="test", primary_group=default_groups[1],
activated=True)
user.save()
return user
示例2: admin_user
def admin_user(default_groups):
"""Creates a admin user."""
user = User(username="test_admin", email="[email protected]",
password="test", primary_group=default_groups[0],
activated=True)
user.save()
return user
示例3: user
def user(default_groups):
"""Creates a user with normal permissions."""
user = User(username="test_normal", email="[email protected]",
password="test", primary_group=default_groups[3],
activated=True)
user.save()
return user
示例4: save
def save(self):
user = User(username=self.username.data,
email=self.email.data,
password=self.password.data,
date_joined=datetime.utcnow(),
primary_group_id=4)
return user.save()
示例5: create_admin_user
def create_admin_user(username, password, email):
"""
Creates the administrator user
"""
admin_group = Group.query.filter_by(admin=True).first()
user = User(username=username, password=password, email=email,
date_joined=datetime.utcnow(), primary_group_id=admin_group.id)
user.save()
示例6: unactivated_user
def unactivated_user(default_groups):
"""
Creates an unactivated user in the default user group
"""
user = User(username='notactive', email='[email protected]',
password='password', primary_group=default_groups[3],
activated=False)
user.save()
return user
示例7: moderator_user
def moderator_user(forum, default_groups):
"""Creates a test user for whom the permissions should be checked"""
user = User(username="test_mod", email="[email protected]",
password="test", primary_group_id=default_groups[2].id)
user.save()
forum.moderators.append(user)
forum.save()
return user