OK sweet, got that part working without the need for the “attrs” attribute. Seems I just needed to manually stop and restart the server. I feel like I’m getting close now. Thanks for all your help on this by the way! 4 hours so far! WOW! amazing!
So now I’ve copied the code from the select widget as you suggested, and it looks like this after modification:
<datalist name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
<optgroup label="{{ group_name }}">{% endif %}{% for option in group_choices %}
{% include option.template_name with widget=option %}{% endfor %}{% if group_name %}
</optgroup>{% endif %}{% endfor %}
</datalist>
I’m pretty sure I still need to change that “django/forms/widgets/attrs.html” to something, but I’m not sure what. And right now, I’ve got another issue locating the template.
my template dirs looks like this:
'DIRS': [os.path.join(BASE_DIR, 'templates')],
So I have my templates for my apps on the same level as the manage.py file and the other apps.
I put the copied template code from above into “templates/forms/datalist.html”. I also modified mySubclass to be:
class mySubclass(Input):
input_type = 'text'
template_name ="forms/datalist.html"
But now I’m getting the error:
venv\lib\site-packages\django\template\backends\django.py", line 84, in reraise
raise new from exc
django.template.exceptions.TemplateDoesNotExist: forms/datalist.html
Any idea what I might be doing wrong?
Thanks again!