我对一个对象使用多表继承,并且我需要将父对象外键引用的选择限制为只应用子系统的规则。你知道吗
from schedule.models import Event, Rule
class AirShowRule(Rule):
"""
Inheritance of the schedule.Rule
"""
rule_type = models.TextField(default='onAir')
class AirShow(Event):
station = models.ForeignKey(Station)
image = models.ImageField(upload_to='images/airshow', null=True, blank= True)
thumb_image = models.ImageField(upload_to='images/airshow', null=True, blank= True)
现在,在管理中,我只希望AirShow规则是AirShow(事件)的选项。我得到的是世界上所有的规则日程表.事件系统。你知道吗
我继承了在http://code.google.com/p/django-schedule/找到的django时间表
我查看了列出的类的结构,您应该添加以下内容:
这应该把一切都弄清楚(从“规则”改为“AirShowRule”)
您还应该确保更完整地实现AirShowRule,因为我认为您没有覆盖rule类型,如果是,我认为它不会满足您的所有要求
*见:models.py:23
…这一行取自models.py:103,并修改了参数:verbose\uuuuu name和help\u text(可能是可选的,但我将留给您检查)
请注意,我以前没有使用过这些模块,但这会推动您继续使用:)
相关问题 更多 >
编程相关推荐