Example #1
0
def form_example_4(request):
    ensure_objects()
    return Form.as_edit_page(instance=Foo.objects.all().first(),
                             actions=dict(
                                 foo=Action.submit(attrs__value='Foo'),
                                 bar=Action.submit(attrs__value='Bar'),
                                 back=Action(display_name='Back to index',
                                             attrs__href='/'),
                             ))
Example #2
0
def form_example_5(request):
    ensure_objects()
    return Form.as_create_page(
        model=Bar,
        fields__b__input__template='iommi/form/choice_select2.html',
        actions=dict(
            foo=Action.submit(attrs__value='Foo'),
            bar=Action.submit(attrs__value='Bar'),
            back=Action(display_name='Back to index', attrs__href='/'),
        ))
Example #3
0
def form_example_6(request):
    return Form.edit(auto__instance=Artist.objects.all().first(),
                     actions=dict(
                         foo=Action.submit(attrs__value='Foo'),
                         bar=Action.submit(attrs__value='Bar'),
                         a=Action.submit(attrs__value='Foo', group='x'),
                         b=Action.submit(attrs__value='Bar', group='x'),
                         back=Action(display_name='Back to index',
                                     attrs__href='/'),
                     ))
Example #4
0
def test_render_submit():
    submit = Action.submit(display_name='Do it').bind()
    assert_renders(
        submit,
        '''
       <button accesskey="s" name="-">Do it</button>
    ''',
    )
Example #5
0
def test_render_submit():
    submit = Action.submit(display_name='Do it').bind()
    assert_renders(
        submit, '''
       <input accesskey="s" name="-" type="submit" value="Do it"/>
    ''')