torchbox / tbxforms

A Torchbox-flavoured template pack for django-crispy-forms, adapted from crispy-forms-gds.
https://pypi.org/project/tbxforms/
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

Using Button raises AttributeError #48

Closed patrickcuagan closed 1 year ago

patrickcuagan commented 1 year ago

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.

kbayliss commented 1 year ago

@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).

kbayliss commented 1 year ago

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.