表单不处理布尔数据

时间:2014-04-22 20:58:16

标签: python html css django

####From views.py####
class ToolCreate(CreateView):
   model = ToolCalibration
   template_name = "create.html"
   success_url = '/toolcal/success'

####From create.html####
<form method="post">
{% csrf_token %}
{{ form.as_ul }}
<input type="submit" value="Save">
</form>

####From models.py####
class ToolCalibration(models.Model):
schema = models.ForeignKey(EnterpriseSchema, verbose_name="Location")
old_control_number = models.CharField(max_length=25, blank=True)
due_date = models.DateField()
last_certified = models.DateField()
tool_status = models.ForeignKey(ToolStatus)
calibration_interval = models.ForeignKey(CalibrationInterval)
calibration_method = models.ForeignKey(CalibrationMethod)
usage_location = models.ForeignKey(UsageLocation)
description = models.CharField(max_length=75)
manufacturer = models.ForeignKey(Manufacturer)
usage_range = models.CharField(max_length=35)
notes = models.TextField(blank=True)
po_required = models.BooleanField("Purchase order required")
po_number = models.CharField("Purchase order number", max_length=35, blank=True, null=True)
ra_number = models.CharField("Return authorization number", max_length=35, blank=True)
calibration_cost = models.CharField(max_length=30)
vendor = models.ForeignKey(Vendor)
date_sent = models.DateField()
date_returned = models.DateField()
man_hours = models.CharField("In-house man hours", max_length=25)
technician = models.CharField(max_length=45)
facility = models.CharField(max_length=45)
out_of_tolerance = models.BooleanField()
tolerance_notes = models.TextField(blank=True)

使用上面的代码时,除了我的布尔字段外,我的所有字段都有一个输入数据的表单。理想情况下会出现一个复选框但是唉,情况并非如此。

感谢所有帮助,谢谢!

编辑:事实证明我使用的CSS样式表具有&#34; webkit-appearance:none;&#34;的表单属性。感谢你们的帮助!

0 个答案:

没有答案