crispy-forms-foundation icon indicating copy to clipboard operation
crispy-forms-foundation copied to clipboard

sequence item 1: expected str instance, BoundField found

Open Tjorriemorrie opened this issue 3 years ago • 2 comments

forms.py

class NameForm(forms.Form):
    your_name = forms.CharField(label='Your name', max_length=100)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_action = 'POST'

views.py

'form': forms.NameForm(),

template

{% load crispy_forms_tags %}
{% crispy form %}

I get the error: sequence item 1: expected str instance, BoundField found

site-packages/crispy_forms_foundation/templates/foundation-6/field.html, error at line 22

Tjorriemorrie avatar May 28 '22 07:05 Tjorriemorrie

Did you find a solution to this?

bluespider42 avatar Oct 12 '22 09:10 bluespider42

I fixed this by changing CrispyFoundationFieldNode.render to return str(field) instead of field. This matches the render method of the most recent release of crispy_forms.
Line 88

bluespider42 avatar Oct 12 '22 09:10 bluespider42

I believe this issue can be closed as it was fixed in release 0.9.0

sprda avatar May 31 '23 13:05 sprda

Yeah it have been fixed in https://github.com/sveetch/crispy-forms-foundation/commit/541a76ac9b786760f7588c93d29ab33d56354bc3 i forgot to close this issue

sveetch avatar May 31 '23 19:05 sveetch