5👍
✅
in the view:
def your_handler(request):
z = [1, 2, 3, 4]
return render(request, 'yourapp/your_template.html', {'z': z})
in the template:
<label>values in z<label>
<select id="the-id">
{% for i in z %}
<option value="{{ i }}">{{ i }}</option>
{% endfor %}
</select>
Source:stackexchange.com