Как добавить другую модель внутрь первой модели с помощью @property? django

У меня есть модель Slot, и модель OutletToSlot. В OutletToSlot я могу получить Slot, но в slot я не могу этого сделать. Итак, я хочу добавить вторую модель внутри моей первой модели, почему мое решение не работает?

 class Slot(models.Model):
        owner = models.ForeignKey(Profile, null=True, blank=True, on_delete=models.CASCADE)
        outletsSlotInventory = models.ForeignKey(OutletsSlotInventory, on_delete=models.CASCADE)
        id = models.UUIDField(default=uuid.uuid4, unique=True,
                              primary_key=True, editable=False)
    
        class Meta:
            unique_together = [['owner', 'outletsSlotInventory']]
    
        @property
        def outletToSlot(self):
            outletToSlots = self.outletToSlot_set.all()
            myOutletsToSlots = outletToSlots.filter(owner.id=id);
            return myOutletsToSlots
    
        def __str__(self) -> str:
            return str(id)
    
    
    class OutletToSlot(models.Model):
        outletToSlotId = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
        expireTime = models.DateTimeField(blank=True)
        outlet = models.ForeignKey(Outlet, null=True, blank=True, on_delete=models.CASCADE, default=0)
        slot = models.OneToOneField(Slot, null=True, blank=True, on_delete=models.CASCADE)
    
        def __str__(self) -> str:
            return "{0} - {1}".format(self.outlet.label, self.slot)
Вернуться на верх