我有两个模型,例如:
def Product(models.Model):
thename = models.CharField(max_length=50)
unity = models.CharField(max_length=50)
price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
def Req(models.Model):
producto = models.ForeignKey(Producto)
# other fields
所以我有一个 Req 类的表格。我需要在模板中显示 producto 的 3 个值来选择其中一个查询集。
例如,在 html 中有:
<select>
<option value="1">Brand Soap - Pieces - 1.99</option>
<option value="2">Cokies - Box - 5.99</option>
</select>