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


Python SignupCode.check方法代码示例

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


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

示例1: is_open

# 需要导入模块: from account.models import SignupCode [as 别名]
# 或者: from account.models.SignupCode import check [as 别名]
 def is_open(self):
     code = self.request.REQUEST.get('code')
     if code:
         try:
             self.signup_code = SignupCode.check(code)
         except SignupCode.InvalidCode:
             return settings.ACCOUNT_OPEN_SIGNUP
         else:
             return True
     else:
         return settings.ACCOUNT_OPEN_SIGNUP
开发者ID:CharlesCliff,项目名称:dannysite.com,代码行数:13,代码来源:views.py

示例2: clean_code

# 需要导入模块: from account.models import SignupCode [as 别名]
# 或者: from account.models.SignupCode import check [as 别名]
 def clean_code(self):
     try:
         signup_code = SignupCode.check(self.cleaned_data.get("code"))
     except SignupCode.InvalidCode:
         if not settings.ACCOUNT_OPEN_SIGNUP:
             raise forms.ValidationError(_("Signup code is invalid."))
         else:
             return None
     else:
         if not settings.ACCOUNT_OPEN_SIGNUP and signup_code is None:
             raise forms.ValidationError(_("Code is required to signup."))
         return signup_code
开发者ID:soon404,项目名称:django-user-accounts,代码行数:14,代码来源:forms.py

示例3: is_open

# 需要导入模块: from account.models import SignupCode [as 别名]
# 或者: from account.models.SignupCode import check [as 别名]
 def is_open(self):
     code = self.request.REQUEST.get("code")
     if code:
         try:
             self.signup_code = SignupCode.check(code)
         except SignupCode.InvalidCode:
             if self.messages.get("invalid_signup_code"):
                 messages.add_message(
                     self.request,
                     self.messages["invalid_signup_code"]["level"],
                     self.messages["invalid_signup_code"]["text"] % {
                         "code": code
                     }
                 )
             return settings.ACCOUNT_OPEN_SIGNUP
         else:
             return True
     else:
         return settings.ACCOUNT_OPEN_SIGNUP
开发者ID:LokiikoL,项目名称:django-user-accounts,代码行数:21,代码来源:views.py

示例4: is_open

# 需要导入模块: from account.models import SignupCode [as 别名]
# 或者: from account.models.SignupCode import check [as 别名]
 def is_open(self):
     code = self.request.REQUEST.get('code')
     if code:
         try:
             self.signup_code = SignupCode.check(code)
         except SignupCode.InvalidCode:
             if self.messages.get('invalid_signup_code'):
                 messages.add_message(
                     self.request,
                     self.messages['invalid_signup_code']['level'],
                     self.messages['invalid_signup_code']['text'].format(**{
                         'code': code
                     })
                 )
             return settings.ACCOUNT_OPEN_SIGNUP
         else:
             return True
     else:
         return settings.ACCOUNT_OPEN_SIGNUP
开发者ID:RyanLyu,项目名称:dannysite.com,代码行数:21,代码来源:views.py

示例5: get

# 需要导入模块: from account.models import SignupCode [as 别名]
# 或者: from account.models.SignupCode import check [as 别名]
 def get(self, *args, **kwargs):
     if self.request.user.is_authenticated():
         return redirect(default_redirect(self.request, settings.ACCOUNT_LOGIN_REDIRECT_URL))
     code = self.request.GET.get("code")
     try:
         self.signup_code = SignupCode.check(code)
     except SignupCode.InvalidCode:
         if not settings.ACCOUNT_OPEN_SIGNUP:
             return self.closed(code=code)
         else:
             if self.messages.get("invalid_signup_code"):
                 messages.add_message(
                     self.request,
                     self.messages["invalid_signup_code"]["level"],
                     self.messages["invalid_signup_code"]["text"] % {
                         "code": code
                     }
                 )
     if not settings.ACCOUNT_OPEN_SIGNUP and self.signup_code is None:
         return self.closed()
     return super(SignupView, self).get(*args, **kwargs)
开发者ID:soon404,项目名称:django-user-accounts,代码行数:23,代码来源:views.py


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