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>"""))
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
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
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>"""))
def __init__(self, *args, **kwargs): AuthenticationForm.__init__(self, *args, **kwargs) self.fields['username'].label = "Логин" self.fields['password'].label = "Пароль"
def __init__(self, request): AuthenticationForm.__init__(self, request)
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)
def __init__(self, request=None, *args, **kwargs): AuthenticationForm.__init__(self, request=None, *args, **kwargs)
def __init__(self, *args, **kwargs): BootstrapMixin.__init__(self, *args, **kwargs) AuthenticationForm.__init__(self, *args, **kwargs) self.fields['username'].label = u"Email / Login"
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)