谁能帮我解决这个问题。非常感谢您的帮助。谢谢。
这是我的程序
模板.html
<tbody>
{% for condition in conditioner %}
{{ condition.owner }}
{% with "#CCE6FF" as bgcolor %}
<tr>
<td style="height: 30">{{ condition.NEW_DATE }}</td>
<td>
<select class="SMOKER select_input" name="condition">
<option value="{{condition.SMOKER.01}}" >Never</option>
<option value="{{condition.SMOKER.02}}" >Ex-Smoker</option>
</select>
<td><input type="text" name="condition" id="condition{{ forloop.counter }}" value="{{ condition.WEIGHT }}" /></td>
<td><input type="text" name="condition" id="condition{{ forloop.counter }}" value="{{ condition.HEIGHT }}" /></td>
<td><input type="text" name="condition" id="condition{{ forloop.counter }}" value="{{ condition.BP }}" /></td>
</tr>
----more program---
模型.py
class Condition(models.Model):
owner = models.ForeignKey(Afdeling)
CPR = models.ForeignKey(Patient)
NEW_DATE = models.DateField(null = True, blank = True)
smoker = (("01" , 'Never'),
("02" , 'Ex-Smoker'),
SMOKER = models.CharField(max_length = 2, choices = smoker, null = True, blank = True)
WEIGHT = models.DecimalField(max_digits = 5, decimal_places = 1, null = True, blank = True)
HEIGHT = models.DecimalField(max_digits = 5, decimal_places = 1, null = True, blank = True)
BP = models.SmallIntegerField(max_length = 3, null = True, blank = True)
----more models.py---
它显示了表格和选定的选项,但没有显示正确的数据。
在我的数据库中,19 okt 应该是 Ex-Smoker,但在这里它显示 Never 到所有列。
该表的 html 是:
<select class="SMOKER select_input" name="condition">
<option value="2" >Never</option>
<option value >Ex-Smoker</option>
</select>
我希望我的解释是可以理解的,如果有人需要更多澄清,我会尽力解释。我真的需要这方面的帮助。非常感谢你。