コード例 #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper.attrs = {'data_abide': ''}
        self.helper.form_action = '.'

        part1 = [_('Part 1')] + part_1_crispies(pack=self.helper.template_pack)
        part2 = [_('Part 2')] + part_2_crispies(pack=self.helper.template_pack)
        part3 = [_('Part 3')] + part_3_crispies(pack=self.helper.template_pack)
        part4 = [_('Part 4')] + part_4_crispies(pack=self.helper.template_pack)

        self.helper.layout = Layout(
            TabHolder(
                TabItem(*part1),
                TabItem(*part2),
                TabItem(*part3),
                TabItem(*part4),
            ), *buttons_crispies(pack=self.helper.template_pack))
コード例 #2
0
def test_tab(output_test_path, render_output, rendered_template, helper,
             client):
    form = AdvancedForm()
    pack = helper.template_pack

    helper.layout = Layout(
        TabHolder(TabItem('My tab 1', 'simple'),
                  TabItem('My tab 2', 'opt_in'),
                  TabItem('My tab 3', 'longtext'),
                  css_id="meep-meep"))

    rendered = rendered_template(form, helper=helper)

    attempted = render_output(
        os.path.join(output_test_path, pack, "test_tab.html"))
    #write_output(output_test_path, pack, "test_tab.html", rendered)

    assert parse_html(attempted) == parse_html(rendered)
コード例 #3
0
 def __init__(self, *args, **kwargs):
     self.helper = FormHelper()
     self.helper.attrs = {'data_abide': ''}
     self.helper.form_action = '.'
     
     part1 = [_('Part 1')]+part_1_crispies()
     part2 = [_('Part 2')]+part_2_crispies()
     part3 = [_('Part 3')]+part_3_crispies()
     part4 = [_('Part 4')]+part_4_crispies()
     
     self.helper.layout = Layout(
         TabHolder(
             TabItem(*part1),
             TabItem(*part2),
             TabItem(*part3),
             TabItem(*part4),
         ),
         *buttons_crispies()
     )
     
     super(FormByTabsForm, self).__init__(*args, **kwargs)