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


Python AuthenticationForm.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
    def __init__(self, request, *a, **kwa):

        AuthenticationForm.__init__(self, request, *a, **kwa)

        self.fields["next"].initial = request.GET.get("next", "")

        self.request = request
        self.redirect = None
开发者ID:danielquinn,项目名称:spirithunter,代码行数:10,代码来源:forms.py

示例2: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
 def __init__(self, user, ratings_required, ratings_range, num_rating_choices):
     AuthenticationForm.__init__(self)
     self.ratings_range, self.num_rating_choices = ratings_range, num_rating_choices
     choices = [(c, c) for c in ratings_range]
     def get_validator_list(rating_num):
         if rating_num <= num_rating_choices:
             return [validators.RequiredIfOtherFieldsGiven(['rating%d' % i for i in range(1, 9) if i != rating_num], _("This rating is required because you've entered at least one other rating."))]
         else:
             return []
     self.fields.extend([
         oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True,
             validator_list=[self.hasNoProfanities]),
         oldforms.RadioSelectField(field_name="rating1", choices=choices,
             is_required=ratings_required and num_rating_choices > 0,
             validator_list=get_validator_list(1),
         ),
         oldforms.RadioSelectField(field_name="rating2", choices=choices,
             is_required=ratings_required and num_rating_choices > 1,
             validator_list=get_validator_list(2),
         ),
         oldforms.RadioSelectField(field_name="rating3", choices=choices,
             is_required=ratings_required and num_rating_choices > 2,
             validator_list=get_validator_list(3),
         ),
         oldforms.RadioSelectField(field_name="rating4", choices=choices,
             is_required=ratings_required and num_rating_choices > 3,
             validator_list=get_validator_list(4),
         ),
         oldforms.RadioSelectField(field_name="rating5", choices=choices,
             is_required=ratings_required and num_rating_choices > 4,
             validator_list=get_validator_list(5),
         ),
         oldforms.RadioSelectField(field_name="rating6", choices=choices,
             is_required=ratings_required and num_rating_choices > 5,
             validator_list=get_validator_list(6),
         ),
         oldforms.RadioSelectField(field_name="rating7", choices=choices,
             is_required=ratings_required and num_rating_choices > 6,
             validator_list=get_validator_list(7),
         ),
         oldforms.RadioSelectField(field_name="rating8", choices=choices,
             is_required=ratings_required and num_rating_choices > 7,
             validator_list=get_validator_list(8),
         ),
     ])
     if user.is_authenticated():
         self["username"].is_required = False
         self["username"].validator_list = []
         self["password"].is_required = False
         self["password"].validator_list = []
         self.user_cache = user
开发者ID:alatteri,项目名称:informer,代码行数:53,代码来源:comments.py

示例3: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        AuthenticationForm.__init__(self, *args, **kwargs)
        self.error_messages['invalid_login'] = _(u"Пожалуйста, введите верные имя пользователя / адрес электронной почты  и пароль.")
        self.fields['username'].label = _(u"Логин / E-mail")

        self.helper = FormHelper(self)
        self.helper.form_action = '/accounts/login/'
        self.helper.label_class = 'col-md-4'
        self.helper.field_class = 'col-md-8'
        self.helper.layout.append(HTML(u"""<div class="form-group row" style="margin-bottom: 16px;margin-top: -16px;">
                                             <div class="col-md-offset-4 col-md-8">
                                               <a href="{% url "django.contrib.auth.views.password_reset" %}"><small class="text-muted">""" + _(u'Забыли пароль?') + """</small></a>
                                             </div>
                                           </div>
                                           <div class="form-group row">
                                             <div class="col-md-offset-4 col-md-8">
                                               <button type="submit" class="btn btn-secondary">""" + _(u'Войти') + """</button>
                                               <input type="hidden" name="next" value="{{ next }}" />
                                             </div>
                                           </div>"""))
开发者ID:znick,项目名称:anytask,代码行数:22,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     AuthenticationForm.__init__(self, *args, **kwargs)
     self.fields['username'].label = "Логин"
     self.fields['password'].label = "Пароль"
开发者ID:judgerain,项目名称:codelist,代码行数:6,代码来源:forms.py

示例5: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
 def __init__(self, request = None, **kwargs):
     AuthenticationForm.__init__(self, request, **kwargs)
     if request and NONCE_FIELD_NAME in request.REQUEST:
         self.initial[NONCE_FIELD_NAME] = request.REQUEST.get(NONCE_FIELD_NAME)
开发者ID:incuna,项目名称:authentic,代码行数:6,代码来源:views.py

示例6: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
 def __init__(self, request=None, *args, **kwargs):
     AuthenticationForm.__init__(self, request=None, *args, **kwargs)
开发者ID:keiko713,项目名称:shiritori,代码行数:4,代码来源:forms.py

示例7: __init__

# 需要导入模块: from django.contrib.auth.forms import AuthenticationForm [as 别名]
# 或者: from django.contrib.auth.forms.AuthenticationForm import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     BootstrapMixin.__init__(self, *args, **kwargs)
     AuthenticationForm.__init__(self, *args, **kwargs)
     self.fields['username'].label = u"Email / Login"
开发者ID:BooleT37,项目名称:anytask,代码行数:6,代码来源:__init__.py


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