torchbox / tbxforms

A Torchbox-flavoured template pack for django-crispy-forms, adapted from crispy-forms-gds.

Home Page:https://pypi.org/project/tbxforms/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Button raises AttributeError

patrickcuagan opened this issue · comments

Description

When using Button.primary as a submit button, an AttributeError is raised:

*** AttributeError: 'Button' object has no attribute 'input_type'

Cause

This is caused by instantiating a button with the folowing:

Button.primary(
    name="submit",
    type="submit",
    value=self.action_text or _("Submit"),
)

Solution

I've went with using Submit from crispy_forms.layout as a substitute for Button.primary.

@patrickcuagan What version of tbxforms are you using?

Using the latest v1.0.16 I can create a button using your spec just fine (which is also present in wagtail-kit).

Thanks for this @patrickcuagan - another report for this came in this week too.

The good news is that the latest release (1.1.0) seems to have fixed it.