谁能告诉我如何限制我在以下代码中继承的 Page 模型的选择?
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')