私はこのmodels.pyを持っています
class Sitename(models.Model):
#id = models.AutoField(primary_key=True) ## to be removed
site = models.CharField() ## find values
class Equipment(models.Model):
#id = models.AutoField(primary_key=True) ## to be removed
serialno = models.CharField() ## known values
class RSL(models.Model): ##Radio Station License
#id = models.AutoField(primary_key=True) ## to be removed
sitename = models.ForeignKey(Sitename)
equipment = models.ManyToManyField(Equipment)
しか知りEquipment
serialno
ませんが、適切なクエリセットがわかりませんか? これまでのところ、外部キーを照会する方法を知っています。
sn = 'abc'
equip = Equipment.objects.get(serialno=sn)
rsl = RSL.objects.?????
sitename = Site.objects.get(pk=rsl.pk)