在我的问题中,有两个相关的模型:
class Simulation(index.Indexed, ClusterableModel):
name = models.CharField("算例名称", max_length=255, blank=True) name = models.CharField("算例名称", max_length=255, blank=True)
panels = [
MultiFieldPanel([
FieldPanel('name', classname="col10"),
MultiFieldPanel([InlinePanel('simulation',label='simulation_software'),]),
], "算例")
]
class SimulationSoftware(index.Indexed, ClusterableModel):
simulation = ParentalKey(Simulation, related_name='simulation', on_delete=models.CASCADE)
software = models.ForeignKey(DicSoftware, verbose_name="模拟软件", help_text="/admin/home/dicsoftware/", on_delete=models.CASCADE, blank=True, null=True, related_name='+')
scale = models.IntegerField("规模", blank=True);
panels = [
MultiFieldPanel([
FieldPanel('simulation', classname="col12"),
FieldPanel('software', classname="col12"),
FieldPanel('scale', classname="col12"),
], "算例输入")
]
我使用 modeladmin 来管理这两个表中的数据。当我检查一个 Simulation 实例时,我无法检查与之相关的 SimulationSoftware。
如何同时检查两个表数据?
希望得到您的帮助。