# Implementing a Datalist

**URL:** <https://forum.djangoproject.com/t/implementing-a-datalist/2052>\
**Category:** Templates & Frontend\
**Created:** [April 20, 2020, 5:22pm UTC](https://forum.djangoproject.com/t/implementing-a-datalist/2052 "2020-04-20T17:22:42Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![ChimeraBlack1](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@ChimeraBlack1](https://forum.djangoproject.com/u/ChimeraBlack1)\
**Post date:** [April 20, 2020, 9:50pm UTC](https://forum.djangoproject.com/t/implementing-a-datalist/2052/22 "2020-04-20T21:50:27Z")

</div>

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:

```auto
<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:

```auto
'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:

```auto
class mySubclass(Input):
    input_type = 'text'
    template_name ="forms/datalist.html"

```

But now I’m getting the error:

```auto
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!

---

_[View the full topic](https://forum.djangoproject.com/t/implementing-a-datalist/2052)._
