def __init__(self, *args, **kwargs): super(RegisterWebUserForm, self).__init__(*args, **kwargs) persona_fields = [] if settings.IS_SAAS_ENVIRONMENT: persona_fields = [ crispy.Div( hqcrispy.RadioSelect('persona', css_class="input-lg", data_bind="checked: personaChoice, "), data_bind="css: {" " 'has-success': isPersonaChoiceChosen, " " 'has-error': isPersonaChoiceNeeded" "}", ), crispy.Div( hqcrispy.InlineField('persona_other', css_class="input-lg", data_bind="value: personaOther, " "visible: isPersonaChoiceOther, "), data_bind="css: {" " 'has-success': isPersonaChoiceOtherPresent, " " 'has-error': isPersonaChoiceOtherNeeded" "}", ), ] self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = crispy.Layout( crispy.Div(crispy.Fieldset( _('Create Your Account'), hqcrispy.FormStepNumber(1, 2), hqcrispy.InlineField('full_name', css_class="input-lg", data_bind="value: fullName, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: fullName " "}"), crispy.Div( hqcrispy.InlineField( 'email', css_class="input-lg", data_bind="value: email, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: email, " " delayedValidator: emailDelayed " "}", ), crispy.HTML('<p class="validation-message-block" ' 'data-bind="visible: isEmailValidating, ' 'text: validatingEmailMsg"> </p>'), hqcrispy.ValidationMessage('emailDelayed'), data_bind="validationOptions: { allowHtmlMessages: 1 }", ), hqcrispy.InlineField( 'password', css_class="input-lg", autocomplete="new-password", data_bind="value: password, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: password, " " delayedValidator: passwordDelayed " "}", ), hqcrispy.ValidationMessage('passwordDelayed'), hqcrispy.InlineField('phone_number', css_class="input-lg", data_bind="value: phoneNumber, " "valueUpdate: 'keyup'"), hqcrispy.InlineField('atypical_user'), twbscrispy.StrictButton( ugettext("Back"), css_id="back-to-start-btn", css_class="btn btn-default btn-lg hide", ), twbscrispy.StrictButton( ugettext("Next"), css_class="btn btn-primary btn-lg", data_bind="click: nextStep, disable: disableNextStepOne"), hqcrispy.InlineField('is_mobile'), css_class="check-password", ), css_class="form-bubble form-step step-1", style="display: none;"), crispy.Div(crispy.Fieldset( _('Name Your First Project'), hqcrispy.FormStepNumber(2, 2), hqcrispy.InlineField( 'project_name', css_class="input-lg", data_bind="value: projectName, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: projectName " "}", ), crispy.Div(*persona_fields), hqcrispy.InlineField('eula_confirmed', css_class="input-lg", data_bind="checked: eulaConfirmed"), twbscrispy.StrictButton(ugettext("Back"), css_class="btn btn-default btn-lg", data_bind="click: previousStep"), twbscrispy.StrictButton(ugettext("Finish"), css_class="btn btn-primary btn-lg", data_bind="click: submitForm, " "disable: disableNextStepTwo")), css_class="form-bubble form-step step-2", style="display: none;"), )
def __init__(self, *args, **kwargs): self.show_phone_number = kwargs.pop('show_number', False) super(RegisterWebUserForm, self).__init__(*args, **kwargs) if not self.show_phone_number: del self.fields['phone_number'] phone_number_fields = [] else: phone_number_fields = [ hqcrispy.InlineField( 'phone_number', css_class="input-lg", data_bind="value: phoneNumber, " "valueUpdate: 'keyup'" ), ] self.helper = FormHelper() self.helper.form_tag = False self.helper.layout = crispy.Layout( crispy.Div( crispy.Fieldset( _('Create Your Account'), hqcrispy.FormStepNumber(1, 2), hqcrispy.InlineField( 'full_name', css_class="input-lg", data_bind="value: fullName, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: fullName " "}" ), hqcrispy.InlineField( 'email', css_class="input-lg", data_bind="value: email, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: email, " " delayedValidator: emailDelayed " "}", ), crispy.HTML('<p class="validation-message-block" ' 'data-bind="visible: isEmailValidating, ' 'text: validatingEmailMsg"> </p>'), hqcrispy.ValidationMessage('emailDelayed'), hqcrispy.InlineField( 'password', css_class="input-lg", autocomplete="new-password", data_bind="value: password, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: password, " " delayedValidator: passwordDelayed " "}", ), hqcrispy.ValidationMessage('passwordDelayed'), crispy.Div(*phone_number_fields), hqcrispy.InlineField('atypical_user'), twbscrispy.StrictButton( ugettext("Next"), css_class="btn btn-success btn-lg", data_bind="click: nextStep, disable: disableNextStepOne" ), css_class="check-password", ), css_class="form-step step-1", style="display: none;" ), crispy.Div( crispy.Fieldset( _('Name Your First Project'), hqcrispy.FormStepNumber(2, 2), hqcrispy.InlineField( 'project_name', css_class="input-lg", data_bind="value: projectName, " "valueUpdate: 'keyup', " "koValidationStateFeedback: { " " validator: projectName " "}", ), hqcrispy.InlineField( 'eula_confirmed', css_class="input-lg", data_bind="checked: eulaConfirmed" ), twbscrispy.StrictButton( ugettext("Previous"), css_class="btn btn-primary-dark btn-lg", data_bind="click: previousStep" ), twbscrispy.StrictButton( ugettext("Finish"), css_class="btn btn-success btn-lg", data_bind="click: submitForm, " "disable: disableNextStepTwo" ) ), css_class="form-step step-2", style="display: none;" ), )