Closed mperesson closed 5 years ago
Could you please describe how and where this error appears?
I'm using a ModelChoiceField in my form. Widget template used is "templates/material/fields/django_select.html"
On line 2:
{% part bound_field.field %}<{{ field.widget.component|default:'dmc-select' }}><div class="row">
On line 21:
<option {% if value == None or value == '' %}value{% else %}value="{{ value|unlocalize }}"{% endif %}{% if selected %} selected="selected"{% endif %}>{% if value == None or value == '' %}{{ form_select_empty_label|default:choice }}{% else %}{{ choice }}{% endif %}</option>{% endfor %}
Since there is no "component" in "field.widget" (and 'form_select_empty_label' is not declared in te context) the "default" templatetag isn't even called.
I just found the problem.
In my settings.py file, in the "TEMPLATES['OPTIONS']" dict I have this option:
'string_if_invalid': '<< MISSING VARIABLE "%s" >>' if DEBUG else '',
That's what make it bug. If i remove it it's ok.
mm, yep. Thank's for exploration. I almost forgot about that django template functionality.
Development version of viewflow 2.0 form rendering already based on python code and webcomponents.
But for 1.x string_if_invalid
options would not be supported.
Django 2.1.7 Python 3.7 django-material 1.5.2
Problem: 'component' does't exist in Select widget.
What am I doing wrong?
Edit: same for "form_select_empty_label", not defined.