本文整理汇总了Python中evap.evaluation.models.UserProfile.email_needs_login_key方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.email_needs_login_key方法的具体用法?Python UserProfile.email_needs_login_key怎么用?Python UserProfile.email_needs_login_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类evap.evaluation.models.UserProfile
的用法示例。
在下文中一共展示了UserProfile.email_needs_login_key方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clean_email
# 需要导入模块: from evap.evaluation.models import UserProfile [as 别名]
# 或者: from evap.evaluation.models.UserProfile import email_needs_login_key [as 别名]
def clean_email(self):
email = self.cleaned_data.get('email')
if not UserProfile.email_needs_login_key(email):
raise forms.ValidationError(_("HPI users cannot request login keys. Please login using your domain credentials."))
try:
user = UserProfile.objects.get(email__iexact=email)
self.user_cache = user
except UserProfile.DoesNotExist:
raise forms.ValidationError(_("No user with this email address was found. Please make sure to enter the email address already known to the university office."))
return email
示例2: clean_email
# 需要导入模块: from evap.evaluation.models import UserProfile [as 别名]
# 或者: from evap.evaluation.models.UserProfile import email_needs_login_key [as 别名]
def clean_email(self):
email = self.cleaned_data.get('email')
if not UserProfile.email_needs_login_key(email):
raise forms.ValidationError(_("HPI users cannot request login keys. Please login using your domain credentials."))
try:
user = UserProfile.objects.get(email__iexact=email)
self.user_cache = user
except UserProfile.DoesNotExist:
raise forms.ValidationError(_("No user with this email address was found. Please make sure to enter the email address used for course or event registration."))
if not user.is_active:
raise forms.ValidationError(_("Inactive users cannot request login keys."))
return email