Z
Z
zelsky2016-06-20 17:21:43
Django
zelsky, 2016-06-20 17:21:43

How to use Datalist in Django?

The form accepts a string from the datalist, but the validation fails because the string is not a record object in the model, how can I fix it?

Cannot assign "'Тест название'": "Sale.good" must be a "Good" instance.

<datalist id="goods">
         <select>
  {% for good in context %}
      <option value='{{good.name}}'></option>
              {% endfor %}
       </select>
    </datalist>

ps when instead of an input with a datalist there was a simple selectfield, then everything was in order, but this option does not suit

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question