首先请看我下面的代码:
Project = models.ForeignKey(Project,null=False, blank=True)
if Porject is 'A':
Owner = models.CharField(max_length=100, choices=**owner_set_A**)
else:
Owner = models.CharField(max_length=100, choices=**owner_set_B**)
所以所有者的选择应该从 owner_set_A 切换到 B,这取决于 Project 的值。谁告诉我我该怎么做,谢谢蒂米的回复,但是我应该在models.Model中做什么
class Task(models.Model):
project = models.ForeignKey(Project,null=False, blank=True)
if Porject is 'A':
Owner = models.CharField(max_length=100, choices=**owner_set_A**)
else:
Owner = models.CharField(max_length=100, choices=**owner_set_B**)
有没有办法获取项目字段值?