0
我正在py上編程和Django。我有型號: 從「子」表編輯ForeignKey
class Product(mymodels.Base):
title = models.CharField()
price = models.ForeignKey(Price)
promoPrice = models.ForeignKey(Price, related_name="promo_price")
class Price(mymodels.Base): value = models.DecimalField(max_digits=10, decimal_places=3) taxValue = models.DecimalField("Tax Value", max_digits=10, decimal_places=3) valueWithTax = models.DecimalField("Value with Tax", max_digits=10, decimal_places=3)
我想在編輯產品時看到兩種價格的INPUT,但找不到任何可能性。 inlines = [...]僅適用於從價格到產品,在這種情況下這很愚蠢。
感謝信。
我想你需要使自己的表,告訴管理員使用它。 – diegueus9 2010-04-14 20:30:11
我認爲你應該重新考慮你的模型。價格似乎不應該是它自己的模型。我會有價格和促銷價格數字字段,然後taxValue和valueWithTax是產品類的屬性 – Zach 2010-04-16 19:54:10