大约一周前开始学习django并碰壁.真的很感激任何启蒙......
models.py
class data(models.Model):
course = models.CharField(max_length = 250)
def __str__(self):
return self.course
Run Code Online (Sandbox Code Playgroud)
HTML
将models.course中的对象转换为schlist
<link rel="stylesheet" type="text/css" href="{% static '/chosen/chosen.css' %}" />
<form action={% views.process %} method="GET">
<div>
<h4 style="font-family:verdana;">First Course: </h4>
<select data-placeholder="Course" style="width:350px;" class="chosen-select" tabindex="7">
<option value=""></option>
{% for item in schlist %}
<option> {{ item }} </option>
{% endfor %}
</select>
</div>
</br>
<div>
<h4 style="font-family:verdana;">Second Course:</h4>
<select data-placeholder="Course" style="width:350px;" class="chosen-select" tabindex="7">
<option value=""></option>
{% for item in schlist %}
<option> {{ item }} </option>
{% …Run Code Online (Sandbox Code Playgroud)