def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Field.radios("name", legend_size=Size.MEDIUM, legend_tag="h1", inline=True), Field.radios("method", legend_size=Size.MEDIUM, small=True), Button("submit", "Submit"), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.label_size = Size.SMALL self.helper.legend_size = Size.SMALL self.helper.layout = Layout( Div( Field.text("sid", field_width=Fluid.TWO_THIRDS), "goods_nomenclature", "additional_code", "order_number", "measure_type", "regulation", "geographical_area", "footnote", css_class="govuk-grid-row quarters", ), HTML( '<hr class="govuk-section-break govuk-section-break--s govuk-section-break--visible">', ), Div( Div( Field.radios( "start_date_modifier", inline=True, ), "start_date", css_class= "govuk-grid-column-one-half form-group-margin-bottom-2", ), Div( Field.radios( "end_date_modifier", inline=True, ), "end_date", css_class= "govuk-grid-column-one-half form-group-margin-bottom-2", ), css_class="govuk-grid-row govuk-!-margin-top-6", ), HTML( '<hr class="govuk-section-break govuk-section-break--s govuk-section-break--visible">', ), Button("submit", "Search and Filter", css_class="govuk-!-margin-top-6"), HTML( f'<a class="govuk-button govuk-button--secondary govuk-!-margin-top-6" href="{self.clear_url}"> Clear </a>', ), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( Field.text("order_number", label_size=Size.SMALL), Field.text("origin", label_size=Size.SMALL), Field.radios("mechanism", legend_size=Size.SMALL), Field.radios("category", legend_size=Size.SMALL), Button("submit", "Search and Filter", css_class="govuk-!-margin-top-6"), HTML( f'<a class="govuk-button govuk-button--secondary govuk-!-margin-top-6" href="{self.clear_url}"> Clear </a>', ), )
def test_choices(): """Verify hints and dividers are displayed.""" form = RadiosChoiceForm(initial={"method": "email"}) form.helper = FormHelper() form.helper.layout = Layout(Field.radios("method")) assert parse_form(form) == parse_contents(RESULT_DIR, "choices.html")
def test_initial_attributes(): """Verify all the gds attributes are displayed.""" form = RadiosForm(initial={"method": "email"}) form.helper = FormHelper() form.helper.layout = Layout(Field.radios("method")) assert parse_form(form) == parse_contents(RESULT_DIR, "initial.html")