本文整理汇总了Python中auth.models.User.get方法的典型用法代码示例。如果您正苦于以下问题:Python User.get方法的具体用法?Python User.get怎么用?Python User.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth.models.User
的用法示例。
在下文中一共展示了User.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def setUpClass(cls):
cls.user = lambda s, x='[email protected]': User.get(x)
示例2: setUpClass
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def setUpClass(cls):
# fixtures aren't set up yet, so this will return none unless we make it a function
cls.user = lambda x: User.get('[email protected]')
示例3: save
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def save(self):
User.get(self.cleaned_data['email']).forgotpwd()
示例4: clean
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def clean(self):
if 'email' in self.cleaned_data and not User.get(self.cleaned_data['email']):
raise ValidationError('The email address does not exist in our database')
return self.cleaned_data
示例5: load_user
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def load_user(userid):
try:
return User.get(userid)
except Exception as e:
logger.info("Error loading user %s: %s" % (userid, e))
return None
示例6: save
# 需要导入模块: from auth.models import User [as 别名]
# 或者: from auth.models.User import get [as 别名]
def save(self):
sessionID = User.get(email=self.cleaned_data['email']).login()
self.view.cookies['session'] = sessionID