2
models.pyDjango管理顯示字段僅當選擇框具有特定值
class FixedIncome(Asset):
isin = models.CharField(max_length=6, blank=False)
coupon = models.DecimalField(max_digits=7, decimal_places=4, help_text="Percent")
payment_frequency = models.ForeignKey(PaymentFrequency)
months = models.ManyToManyField(Month, blank = False, verbose_name = "Payment months")
duration = models.DecimalField(max_digits=4, decimal_places=2, default='0')
maturity_date = models.DateTimeField(default=datetime.now, blank=False)
class Meta:
verbose_name_plural = "Fixed Income"
欲Django管理顯示MATURITY_DATE屬性,僅當月(數字1至12,選擇框)被選擇。我讀過一些關於JS,但我不能這樣做:(
看起來高度相關..http://stackoverflow.com/questions/15978719/django-admin-show-field-only-if-checkbox-is-false – alecxe