I am facing a problem designing a database with Django framework that i can't seem to solve. Say i have the following models:
class Report(models.Models):
equipment = models.ForeignKey(Equipament)
category = models.ForeignKey(Category)
date = models.DateField()
user = models.CharField(max_length=100)
class TestA(models.Model):
report = models.ForeignKey(Report)
lasers = models.FloatField()
table = models.FloatField()
dose = models.FloatField()
pass_fail = models.NullBooleanField()
class TestB(models.Model):
report = models.ForeignKey(Report)
ctdi = models.FloatField()
pass_fail = models.NullBooleanField()
class TestC(models.Model):
report = models.ForeignKey(Report)
pass_fail = models.NullBooleanField()
My question is: Is it possible to get all objects from Tests B, C and D that share the same oject from Report? I do not wish to query each model (TestB, TestC or TestD) individually because in reality i have many more Test models.
Any help is much apreciated.