在我的模型中有一个选项字段recursion_period
:
class RecurringMeeting(models.Model):
RECURSION_OPTIONS = (
('daily', 'Daily'),
('weekly', 'Weekly'),
)
recursion_period = models.CharField(max_length=50, choices=RECURSION_OPTIONS)
根据recursion_period
值的值,我想继承DailyMeeting
或WeeklyMeeting
抽象模型中的字段:
class DailyMeeting(models.Model):
# some fields here
class Meta:
abstract = True
和
class WeeklyMeeting(models.Model):
# some other fields here
class Meta:
abstract = True
是否可以根据recursion_period
字段的值选择要继承的模型?