0
次のコードで継承したページモデルの選択肢をどのように制限することができますか?すなわち、Djangoモデルの継承とlimit_choices_to
class CaseStudy(Page):
"""
An entry in a fancy picture flow widget for a case study page
"""
image = models.ForeignKey(Image, limit_choices_to={'is_active': True, 'category__code':'RP'})
def __unicode__(self):
return u"%s" % self.title
は、Djangoの管理者はダウンに成功し、ドロップで画像の選択を制限しているが、私は同様に(「親ページフィールド」)ページのモデルにフィールドを制限したいと思います:
class Page(models.Model):
parent = models.ForeignKey('self', blank=True, null=True, related_name='children')