当前位置: 首页>>代码示例>>Python>>正文


Python UserModel.exists方法代码示例

本文整理汇总了Python中registration.users.UserModel.exists方法的典型用法代码示例。如果您正苦于以下问题:Python UserModel.exists方法的具体用法?Python UserModel.exists怎么用?Python UserModel.exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在registration.users.UserModel的用法示例。


在下文中一共展示了UserModel.exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: clean_email

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import exists [as 别名]
 def clean_email(self):
     if self.instance.pk != None:
         existing_user = UserModel().objects.filter(username__iexact=self.cleaned_data['email'])
         existing = Rolnik.objects.get(pk=self.instance.pk)
         if existing_user.exists() and existing.user != existing_user[0]:
             raise forms.ValidationError(_("This email belongs to someone else."))
         return self.cleaned_data['email']
     existing = UserModel().objects.filter(username__iexact=self.cleaned_data['email'])
     if existing.exists():
         raise forms.ValidationError(_("A user with that username already exists."))
     else:
         return self.cleaned_data['email']
开发者ID:pan-mroku,项目名称:plodyrolne,代码行数:14,代码来源:models.py

示例2: clean_email

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import exists [as 别名]
    def clean_email(self):

      existing = UserModel().objects.filter(email__iexact=self.cleaned_data['email'])
      if existing.exists():
        raise forms.ValidationError(_("A user with that email already exists."))
      else:
        return self.cleaned_data['email']
开发者ID:matsinvasion,项目名称:markshelp,代码行数:9,代码来源:forms.py

示例3: clean_username

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import exists [as 别名]
    def clean_username(self):
        """
        Validate that the username is alphanumeric and is not already
        in use.

        """
        existing = UserModel().objects.filter(username__iexact=self.cleaned_data['username'])
        if existing.exists():
            raise forms.ValidationError(_("A user with that username already exists."))
        else:
            return self.cleaned_data['username']
开发者ID:tnbt27,项目名称:Registration_Profile_Search_boilerplate,代码行数:13,代码来源:forms.py

示例4: clean_username

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import exists [as 别名]
    def clean_username(self):
        """
        Validate that the username is alphanumeric and is not already
        in use.

        """
        kwargs = {UserModel().USERNAME_FIELD: self.cleaned_data['username']}
        existing = UserModel().objects.filter(**kwargs)
        if existing.exists():
            raise forms.ValidationError(_("A user with that username already exists."))
        else:
            return self.cleaned_data['username']
开发者ID:Andertaker,项目名称:django-registration,代码行数:14,代码来源:forms.py

示例5: validate_email

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import exists [as 别名]
def validate_email(value):
    existing = UserModel().objects.filter(email__iexact=value)
    if not existing.exists():
        raise forms.ValidationError(_("A user with that email doesn't exists."))
开发者ID:xorsnn,项目名称:lugati,代码行数:6,代码来源:forms.py


注:本文中的registration.users.UserModel.exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。