def extra_layout(self): return Div(Div(PrependedAppendedText('exp_time_blue', 'Blue Arm', 's'), PrependedAppendedText('exp_time_red', 'Red Arm', 's'), css_class='col'), Div('exp_count_blue', 'exp_count_red', css_class='col'), Div('res_blue', 'res_red', css_class='col'), css_class='form-row')
def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.form_tag = False self.helper.form_show_labels = False self.helper.layout = Layout( Accordion( AccordionGroup('Event Details', PrependedText('title', 'Title', placeholder="Title of the Event"), Div( PrependedAppendedText('start_time', 'Begins', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"), css_class="input-group date col-sm-6" ), Div( PrependedAppendedText('end_time', 'Ends', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"), css_class="input-group date col-sm-6" ) ), AccordionGroup('Voters', 'voters', HTML("<p>Comma seperated (.csv) file of valid email addresses</p>"), 'votersTextFile' ), ), ) super(EventEditForm, self).__init__(*args, **kwargs)
def test_prepended_appended_text(self, settings): test_form = SampleForm() test_form.helper = FormHelper() test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com"), AppendedText("password1", "#"), PrependedText("password2", "$"), ) html = render_crispy_form(test_form) # Check form parameters assert html.count('<span class="input-group-text">@</span>') == 1 assert html.count( '<span class="input-group-text">gmail.com</span>') == 1 assert html.count('<span class="input-group-text">#</span>') == 1 assert html.count('<span class="input-group-text">$</span>') == 1 test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com", css_class="form-control-lg")) html = render_crispy_form(test_form) assert 'class="form-control-lg' in html assert contains_partial(html, '<span class="input-group-text"/>')
def __init__(self, *args, **kwargs): super(AsignarUsuariosForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_show_labels = False self.helper.form_action = "home" self.fields['arquitecto'].queryset = Usuario.objects.filter( tipo=Usuario.ARQUITECTO) self.fields['ingeniero'].queryset = Usuario.objects.filter( tipo=Usuario.INGENIERO) self.fields['tesorero'].queryset = Usuario.objects.filter( tipo=Usuario.TESORERO) self.helper.layout = Layout( PrependedAppendedText( 'arquitecto', "<i class='fa fa-user fa-fw'></i>", "arquitecto <a href='/admin/usuarios/usuario/add/'><i class='fa fa-plus'></i></a>", css_class="input-sm"), PrependedAppendedText( 'ingeniero', "<i class='fa fa-user fa-fw'></i>", "dir. obra <a href='/admin/usuarios/usuario/add/'><i class='fa fa-plus'></i></a>", css_class="input-sm"), PrependedAppendedText( 'tesorero', "<i class='fa fa-user fa-fw'></i>", "tesorero <a href='/admin/usuarios/usuario/add/'><i class='fa fa-plus'></i></a>", css_class="input-sm"), StrictButton('Guardar usuarios', type="Submit", css_class="btn-info btn-sm"), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.use_custom_control = True self.helper.layout = Layout( Fieldset( '', Div(Div(PrependedText('title', '<b>Listing Title: </b>'), css_id='titleUpload'), Div(Div('vehicles', css_id='p_v_left'), Div(HTML(""" <p><i class="fas fa-chevron-left"></i> What vehicles can your spot fit?</p> <p> What type of spot is it?<i class="fas fa-chevron-right"></i></p> """), css_id='p_v_middle'), Div('parking', css_id='p_v_right'), css_id='listingUpload2'), Div(Div(HTML(""" <h2>Your Listing Rates</h2> <i class="fas fa-dollar-sign"></i> """), css_id='rateSide'), Div(PrependedAppendedText('hourly_Rate', '$', '.00'), PrependedAppendedText('day_Rate', '$', '.00'), css_id='rateInput'), css_id='listingUpload3'), Div(Div(HTML(""" <h2>Customize</h2> """), css_id='peopleIcon'), Div(HTML(""" <p>Is parking overnight allowed?</p> """), 'overNight', css_class='radioOptions'), Div(HTML(""" <p>Will you meed to meet renters?</p> """), 'meet_Renter', css_class='radioOptions'), Div(HTML(""" <p>Do they need a parking pass?</p> """), 'parking_Pass', css_class='radioOptions'), css_id="listingUpload4"), Div(Div(HTML(""" <h2>Describe your listing for renters</h2> <i class="far fa-laugh-beam"></i> """), css_id='descripSide'), 'description', css_id='listingUpload5'), Div(FormActions( Submit('Preview Listing', 'Preview Listing')), css_id='btnListing'), css_id="listingUploadDiv")))
def test_prepended_appended_text(self, settings): test_form = SampleForm() test_form.helper = FormHelper() test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com"), AppendedText("password1", "#"), PrependedText("password2", "$"), ) html = render_crispy_form(test_form) dom = parse_html(html) # Check form parameters if settings.CRISPY_TEMPLATE_PACK == "css": assert dom.count(parse_html('<span class="add-on">@</span>')) == 1 assert dom.count( parse_html('<span class="add-on">gmail.com</span>')) == 1 assert dom.count(parse_html('<span class="add-on">#</span>')) == 1 assert dom.count(parse_html('<span class="add-on">$</span>')) == 1 if settings.CRISPY_TEMPLATE_PACK == "bootstrap3": assert html.count('<span class="input-group-addon">@</span>') == 1 assert html.count( '<span class="input-group-addon">gmail.com</span>') == 1 assert html.count('<span class="input-group-addon">#</span>') == 1 assert html.count('<span class="input-group-addon">$</span>') == 1 test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com", css_class="input-lg"), ) html = render_crispy_form(test_form) assert 'class="input-lg' in html assert contains_partial( html, '<span class="input-group-addon input-lg"/>') if settings.CRISPY_TEMPLATE_PACK == "bootstrap4": assert html.count('<span class="input-group-text">@</span>') == 1 assert html.count( '<span class="input-group-text">gmail.com</span>') == 1 assert html.count('<span class="input-group-text">#</span>') == 1 assert html.count('<span class="input-group-text">$</span>') == 1 test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com", css_class="form-control-lg"), ) html = render_crispy_form(test_form) assert 'class="form-control-lg' in html assert contains_partial(html, '<span class="input-group-text"/>')
def test_prepended_wrapper_class(self, settings): test_form = SampleForm() test_form.helper = FormHelper() test_form.helper.layout = Layout( PrependedAppendedText("email", "@", "gmail.com", wrapper_class="wrapper class"), PrependedAppendedText("email", "@", "gmail.com"), ) html = render_crispy_form(test_form) assert html.count('<div id="div_id_email" class="form-group">') == 1 assert html.count( '<div id="div_id_email" class="form-group wrapper class">') == 1
def test_prepended_appended_text(self, settings): test_form = SampleForm() test_form.helper = FormHelper() test_form.helper.layout = Layout( PrependedAppendedText('email', '@', 'gmail.com'), AppendedText('password1', '#'), PrependedText('password2', '$'), ) html = render_crispy_form(test_form) dom = parse_html(html) # Check form parameters if settings.CRISPY_TEMPLATE_PACK == 'bootstrap': assert dom.count(parse_html('<span class="add-on">@</span>')) == 1 assert dom.count( parse_html('<span class="add-on">gmail.com</span>')) == 1 assert dom.count(parse_html('<span class="add-on">#</span>')) == 1 assert dom.count(parse_html('<span class="add-on">$</span>')) == 1 if settings.CRISPY_TEMPLATE_PACK in ['bootstrap3', 'bootstrap4']: assert html.count('<span class="input-group-addon">@</span>') == 1 assert html.count( '<span class="input-group-addon">gmail.com</span>') == 1 assert html.count('<span class="input-group-addon">#</span>') == 1 assert html.count('<span class="input-group-addon">$</span>') == 1 if settings.CRISPY_TEMPLATE_PACK == 'bootstrap3': test_form.helper.layout = Layout( PrependedAppendedText('email', '@', 'gmail.com', css_class='input-lg'), ) html = render_crispy_form(test_form) assert 'class="input-lg' in html assert contains_partial( html, '<span class="input-group-addon input-lg"/>') if settings.CRISPY_TEMPLATE_PACK == 'bootstrap4': test_form.helper.layout = Layout( PrependedAppendedText('email', '@', 'gmail.com', css_class='form-control-lg'), ) html = render_crispy_form(test_form) assert 'class="form-control-lg' in html assert contains_partial(html, '<span class="input-group-addon"/>')
def test_error_text_inline(self): form = TestForm({'email': 'invalidemail'}) form.helper = FormHelper() layout = Layout( AppendedText('first_name', 'wat'), PrependedText('email', '@'), PrependedAppendedText('last_name', '@', 'wat'), ) form.helper.layout = layout form.is_valid() html = render_crispy_form(form) help_class = 'help-inline' if self.current_template_pack == 'bootstrap3': help_class = 'help-block' matches = re.findall('<span id="error_\d_\w*" class="%s"' % help_class, html, re.MULTILINE) self.assertEqual(len(matches), 3) form = TestForm({'email': 'invalidemail'}) form.helper = FormHelper() form.helper.layout = layout form.helper.error_text_inline = False html = render_crispy_form(form) matches = re.findall('<p id="error_\d_\w*" class="help-block"', html, re.MULTILINE) self.assertEqual(len(matches), 3)
def layout(self): return Div(Div(Div('project', css_class='form-row'), Div('startdate', 'starttime', css_class='form-row'), Div('enddate', 'endtime', css_class='form-row'), css_class='col-md-16'), Div(Div(css_class='col-md-2'), Div(PrependedText('max_airmass', 'Airmass <'), PrependedAppendedText('max_seeing', 'Seeing <', 'arcsec'), PrependedAppendedText('max_skybri', 'Dark + ', 'mag/arcsec\xB2'), InlineRadios('photometric'), css_class='col-md-8'), css_class='form-row'), HTML('<hr width="85%"><h4>Instrument Config</h4>'), css_class='form-row')
def test_prepended_appended_text(self): test_form = TestForm() test_form.helper = FormHelper() test_form.helper.layout = Layout( PrependedAppendedText('email', '@', 'gmail.com'), AppendedText('password1', '#'), PrependedText('password2', '$'), ) html = render_crispy_form(test_form) # Check form parameters if self.current_template_pack == 'bootstrap': self.assertEqual(html.count('<span class="add-on">@</span>'), 1) self.assertEqual( html.count('<span class="add-on">gmail.com</span>'), 1) self.assertEqual(html.count('<span class="add-on">#</span>'), 1) self.assertEqual(html.count('<span class="add-on">$</span>'), 1) if self.current_template_pack == 'bootstrap3': self.assertEqual( html.count('<span class="input-group-addon">@</span>'), 1) self.assertEqual( html.count('<span class="input-group-addon">gmail.com</span>'), 1) self.assertEqual( html.count('<span class="input-group-addon">#</span>'), 1) self.assertEqual( html.count('<span class="input-group-addon">$</span>'), 1)
def test_bootstrap_form_show_errors_bs3(): form = SampleForm({ "email": "invalidemail", "first_name": "first_name_too_long", "last_name": "last_name_too_long", "password1": "yes", "password2": "yes", }) form.helper = FormHelper() form.helper.layout = Layout( AppendedText("email", "whatever"), PrependedText("first_name", "blabla"), PrependedAppendedText("last_name", "foo", "bar"), AppendedText("password1", "whatever"), PrependedText("password2", "blabla"), ) form.is_valid() form.helper.form_show_errors = True assert parse_form(form) == parse_expected( "bootstrap3/test_form_helper/bootstrap_form_show_errors_bs3_true.html") form.helper.form_show_errors = False assert parse_form(form) == parse_expected( "bootstrap3/test_form_helper/bootstrap_form_show_errors_bs3_false.html" )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper.layout = Layout( self.common_layout, Div(Div(HTML("<p></p>"), PrependedText('observation_type', "Observation Type"), css_class='col'), Div(HTML("<p></p>"), PrependedAppendedText('window', 'Once in the next', 'days'), Div(Div(PrependedText('g_exptime', 'g'), css_class='col-md-6'), css_class='form-row'), Div(Div(PrependedText('r_exptime', 'r'), css_class='col-md-6'), css_class='form-row'), Div(Div(PrependedText('i_exptime', 'i'), css_class='col-md-6'), css_class='form-row'), Div(Div(PrependedText('z_exptime', 'z'), css_class='col-md-6'), css_class='form-row'), css_class='col'), Div(HTML("<p></p>"), PrependedText('max_airmass', 'Airmass <'), css_class='col'), css_class='form-row'))
def test_error_text_inline(settings): form = SampleForm({"email": "invalidemail"}) form.helper = FormHelper() layout = Layout( AppendedText("first_name", "wat"), PrependedText("email", "@"), PrependedAppendedText("last_name", "@", "wat"), ) form.helper.layout = layout form.is_valid() html = render_crispy_form(form) help_class = "invalid-feedback" help_tag_name = "div" matches = re.findall(r'<span id="error_\d_\w*" class="%s"' % help_class, html, re.MULTILINE) assert len(matches) == 3 form = SampleForm({"email": "invalidemail"}) form.helper = FormHelper() form.helper.layout = layout form.helper.error_text_inline = False html = render_crispy_form(form) help_class = "invalid-feedback" help_tag_name = "p" matches = re.findall( r'<{} id="error_\d_\w*" class="{}"'.format(help_tag_name, help_class), html, re.MULTILINE, ) assert len(matches) == 3
def test_form_show_labels(): form = TestForm() form.helper = FormHelper() form.helper.layout = Layout( 'password1', FieldWithButtons( 'password2', StrictButton("Confirm") ), PrependedText( 'first_name', 'Mr.' ), AppendedText( 'last_name', '@' ), PrependedAppendedText( 'datetime_field', 'on', 'secs' ) ) form.helper.form_show_labels = False html = render_crispy_form(form) assert html.count("<label") == 0
def test_error_text_inline(settings): form = TestForm({'email': 'invalidemail'}) form.helper = FormHelper() layout = Layout( AppendedText('first_name', 'wat'), PrependedText('email', '@'), PrependedAppendedText('last_name', '@', 'wat'), ) form.helper.layout = layout form.is_valid() html = render_crispy_form(form) help_class = 'help-inline' if settings.CRISPY_TEMPLATE_PACK in ['bootstrap3', 'bootstrap4']: help_class = 'help-block' matches = re.findall( '<span id="error_\d_\w*" class="%s"' % help_class, html, re.MULTILINE ) assert len(matches) == 3 form = TestForm({'email': 'invalidemail'}) form.helper = FormHelper() form.helper.layout = layout form.helper.error_text_inline = False html = render_crispy_form(form) matches = re.findall('<p id="error_\d_\w*" class="help-block"', html, re.MULTILINE) assert len(matches) == 3
def test_bootstrap_form_show_errors_bs4(): form = SampleForm({ "email": "invalidemail", "first_name": "first_name_too_long", "last_name": "last_name_too_long", "password1": "yes", "password2": "yes", }) form.helper = FormHelper() form.helper.layout = Layout( AppendedText("email", "whatever"), PrependedText("first_name", "blabla"), PrependedAppendedText("last_name", "foo", "bar"), AppendedText("password1", "whatever"), PrependedText("password2", "blabla"), ) form.is_valid() form.helper.form_show_errors = True html = render_crispy_form(form) assert html.count("error") == 3 form.helper.form_show_errors = False html = render_crispy_form(form) assert html.count("error") == 0
def test_bootstrap_form_show_errors(): form = TestForm({ 'email': 'invalidemail', 'first_name': 'first_name_too_long', 'last_name': 'last_name_too_long', 'password1': 'yes', 'password2': 'yes', }) form.helper = FormHelper() form.helper.layout = Layout( AppendedText('email', 'whatever'), PrependedText('first_name', 'blabla'), PrependedAppendedText('last_name', 'foo', 'bar'), AppendedText('password1', 'whatever'), PrependedText('password2', 'blabla'), ) form.is_valid() form.helper.form_show_errors = True html = render_crispy_form(form) assert html.count('error') == 3 form.helper.form_show_errors = False html = render_crispy_form(form) assert html.count('error') == 0
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['proposal'] = forms.ChoiceField(choices=self.proposal_choices(),initial='TOM2020A-002') self.helper.layout = Layout( self.common_layout, Div( Div( HTML("<p></p>"), PrependedAppendedText( 'window','Once in the next', 'days' ), PrependedText('exposure_time','Exposure Time'), PrependedText('exposure_count','Exposure Count'), PrependedText('rotator_angle','Rotator Angle'), css_class='col' ), Div( HTML("<p></p>"), PrependedText('max_airmass', 'Airmass <'), PrependedText('ipp_value', 'IPP'), 'proposal', 'observation_mode', css_class='col' ), css_class='form-row', ), self.button_layout() )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['username'].widget.attrs['placeholder'] = 'Email ID' self.fields['password'].widget.attrs['placeholder'] = 'Password' self.helper = FormHelper(self) self.helper.form_show_labels = False self.helper.layout = Layout( PrependedAppendedText( 'username', prepended_text='<i class="fas fa-envelope"></i>'), PrependedAppendedText('password', prepended_text='<i class="fas fa-key"></i>'), ButtonHolder( Submit('login', value="Login", css_class='btn-lg btn-block')), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.add_input(Submit('submit', 'Create Project')) #self.helper.add_input(Submit('cancel', 'Cancel', css_class='btn-default')) self.helper.form_tag = False self.helper.layout = Layout( HTML(""" <p>Please answer a few questions to <strong>get started</strong></p> """), Field('project'), # HTML(""" # <p>Please add a name for your project <strong>make if unique</strong></p> # """), Field('description', placeholder ='Please add a detailed description for your project'), # HTML(""" # <p>Please add a detailed description for your project</p> # """), Field('resolution', placeholder='If you have a preferred resolution for your project please detail it here.'), # HTML(""" # <p>If you have a preferred resolution for your project please detail it here.</p> # """), Field('startdate',placeholder='please format startdate date like this 12/1/2018'), Field('deadline', placeholder="please format deadline date like this 12/1/2018"), PrependedAppendedText('budget', '$', '.00', css_class='input-sm'), InlineRadios('status'), #Submit('Submit', 'Submit', css_class="btn-success"), )
def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.label_class = 'be-bold col-md-2' self.helper.field_class = 'col-md-10' self.helper.layout = Layout( Fieldset( "", 'listing', HTML("<div class='col-md-4'>"), PrependedAppendedText('price', '$', '.00', placeholder="whole numbers"), HTML("</div><div class='col-md-6'>"), 'text', HTML("</div><div class='col-md-2'>"), FormActions(Submit('submit', 'Submit', css_class='btn-primary')), HTML("</div>"), ), ) super(BidForm, self).__init__(*args, **kwargs) self.fields['text'].label = "Comments"
def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.form_tag = False self.helper.form_show_labels = False self.helper.layout = Layout( Accordion( AccordionGroup( 'Event Details', PrependedText('title', 'Title', placeholder="Title of the Event"), Div(PrependedAppendedText( 'start_time', 'Begins', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"), css_class="input-group date col-sm-6"), Div(PrependedAppendedText( 'end_time', 'Ends', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"), css_class="input-group date col-sm-6"), Field('captcha')), AccordionGroup( "Organisers", HTML( "<p>Event creators are automatically made an Organiser. Click and drag the tabs to reorder. Blank fields will be ignored.</p>" ), Formset("organiser_formset", "polls/create_option.html", OrganiserFormSetHelper()), ), AccordionGroup( 'Trustees', HTML( "<p>Click and drag the tabs to reorder. Blank fields will be ignored.</p>" ), Formset("trustee_formset", "polls/create_option.html", TrusteeFormSetHelper()), ), AccordionGroup( 'Voters', 'voters', HTML( "<p>Comma seperated (.csv) file of valid email addresses</p>" ), 'votersTextFile'), ), ) super(EventForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(ListingForm, self).__init__(*args, **kwargs) # Define the basics for crispy-forms self.helper = FormHelper() # Some extra vars for form css purposes self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-lg-2 be-bold bottom-padding' self.helper.field_class = 'col-lg-8 bottom-padding' # Field labeling self.fields['isbn'].label = "ISBN" self.fields['course_abbr'].label = "Course" self.fields['description'].label = "Other Notes" # Define 'required' attribute for 'photo' self.fields['photo'].required = False # The main "layout" defined self.helper.layout = Layout( Fieldset("", ####################### Field('isbn', placeholder='0801884039', style="width: 155px;"), # Collapsed elements HTML('<div class="collapse" id="section-collapse">'), Field('title', placeholder='Squirrels: The Animal Answer Guide'), Field('author', placeholder='Richard W. Thorington, Jr., and Katie Ferrell'), Field('edition', placeholder='1', style="width: 82px;"), Field('year', placeholder='2006', style="width: 82px;"), HTML('</div>'), Field('course_abbr', placeholder='ENGH 302', style="width: 82px;"), Field('condition', style="width: 190px;"), Field('access_code', style="width: 190px;"), PrependedAppendedText( 'price', '$', '.00', placeholder="whole nums", style="width: 107px;", template='crispy/prepended_appended_text.html' ), Field('photo'), Field('description', placeholder='I would be willing to exchange this textbook for one that I need next semester. \n\n/// This is for Professor Smith\'s section ONLY. ///\n\nI can give you the workbook as well.'), ####################### FormActions( Submit('submit', 'Create Listing', css_class='btn-primary'), Button('cancel', 'Never Mind', css_class='btn-default', onclick="history.back()") ), ), )
def extra_layout(self): return Div(Div(Div(Div(PrependedAppendedText('exp_time', 'H', 's'), css_class='col-md-6'), Div('exp_count', css_class='col-md-6'), css_class='form-row'), css_class='col-md-6'), Div(css_class='col-md-5'), css_class='form-row')
def __init__(self, *args, **kwargs): super(PollOptionFormSetHelper, self).__init__(*args, **kwargs) self.layout = Layout( Div( Field('DELETE', css_class='input-small hidden'), PrependedAppendedText('choice_text', 'Option', "<span class='glyphicon glyphicon-trash'></span>", placeholder="Option"), css_class="formset_object") )
def __init__(self, *args, **kwargs): super(TrusteeFormSetHelper, self).__init__(*args, **kwargs) self.layout = Layout( Div( Field('DELETE', css_class='input-small hidden'), PrependedAppendedText('email', 'Email ', "<span data-toggle='tooltip' title='Delete this Trustee' class='glyphicon glyphicon-trash'></span>", placeholder="Email address of the trustee"), css_class="formset_object") )
def test_select_prepended(): form = InputsFrom() form.helper = FormHelper() form.helper.layout = Layout( PrependedText("select_input", "bar"), AppendedText("select_input", "bar"), PrependedAppendedText("select_input", "£", ".00"), ) assert parse_form(form) == parse_expected("test_prepended_appended_select.html")
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper.layout = Layout( self.common_layout, Div(Div(Div( HTML("<p></p>"), PrependedText('name', 'Name', type='hidden'), Div( Div(HTML( '<p style="text-align:center;">Gemini North or South?</p>' ), css_class='col-md-4'), Div('n_or_s', css_class='col-md-8'), css_class='form-row', ), PrependedAppendedText('window_size', 'Once in the next', 'days'), PrependedText('max_airmass', 'Airmass <'), Div(Div(PrependedText('mag_approx', 'Approximate mag: '), css_class='col-md-8'), Div(HTML('<p style="text-align:center;">Filter:</p>'), css_class='col-md-2'), Div('mag_approx_filter', css_class='col-md-2'), css_class='form-row'), Div( Div(HTML('<p style="text-align:center;">Grating</p>'), css_class='col-md-2'), Div(HTML( '<p style="text-align:center;">Exposure time (s)</p>'), css_class='col-md-10'), css_class='form-row', ), Div(Div(HTML('<p style="text-align:center;">B600/500nm</p>'), css_class='col-md-4'), Div('b_exptime', css_class='col-md-8'), css_class='form-row'), Div(Div(HTML('<p style="text-align:center;">R400/850nm</p>'), css_class='col-md-4'), Div('r_exptime', css_class='col-md-8'), css_class='form-row'), Div( Div(HTML('<p style="text-align:center;">Slit</p>'), css_class='col-md-12'), css_class='form-row', ), Div(Div('slit', css_class='col-md-12'), css_class='form-row'), Div( Div(HTML('<p style="text-align:center;">Status</p>'), css_class='col-md-12'), css_class='form-row', ), Div(Div('ready', css_class='col-md-12'), css_class='form-row'), ), css_class='col-md-12'), css_class='row justify-content-md-center'), self.button_layout())
def __init__(self, request, *args, **kwargs): self.request = request self.helper = FormHelper() self.helper.form_show_labels = False self.helper.form_tag = False self.helper.layout = Layout( PrependedText('email', '<i class="fas fa-user-circle text-info"></i>', active=True, css_class="rounded-0"), PrependedAppendedText('password', '<i class="fas fa-key text-info"></i>', '<button type="button" @click="passwordshow($event)" class="btn btn-sm bg-transparent remove-outline p-0"><i class="fas fa-eye-slash text-info"></i></button>', active=True, css_class="rounded-0 border-right-0"), ) super(LoginForm, self).__init__(*args, **kwargs)