0
好了,所以我有一個模型,看起來像這樣:的ModelAdmin - 許多一對多內聯
class OpHour(models.Model):
days_of_the_week =((0,"Sunday"),
(1,"Monday"),
(2,"Tuesday"),
(3,"Wednesday"),
(4,"Thursday"),
(5,"Friday"),
(6,"Saturday"))
day = models.IntegerField(max_length=1, choices=days_of_the_week)
opening_time = models.TimeField()
closing_time = models.TimeField()
class Location(models.Model):
name = models.CharField(max_length=200)
[...]
hours = models.ManyToManyField(OpHour)
,我想顯示和編輯OpHour在該位置的改變頁面內聯。如何使用ModelAdmin實現此目的?
有益https://docs.djangoproject.com/en/dev/ref/contrib/admin/#working-with-a-在
"through"
專門研究模型有二個或更多的外國密鑰對的 - 同父模型 – Paulo