Django Query across multiple models

So I am looking for some help (and hopefully and explanation) of how I access data across my multiple models because this one has left me completely snookered.

I have a system for the sale of events (events model) now these events have multiple products(products model) and variable prices dependant on when you book (prices model), this part is working fine.

Where I am struggling is there are also bundles of products (bundles table) which contain multiple products, and I need to get their attached prices. Now I have a list of bundles attached to the products being viewed but am struggling to query the ORM and get a full record - <Products (multiple)> - .

I'm not completely new at this but it has left my completely stumped so any help would be greatly received. I have attached a sketch of the DB to help visualise.

Thanks

EDIT: The model is now include below.

from events.models import events
import uuid
import datetime


class products(models.Model):
    id                          = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False, verbose_name="ProductID")
    name                        = models.CharField(max_length=255, verbose_name="Product Name")
    linkedtoevent               = models.ForeignKey(to=events, on_delete=models.CASCADE, verbose_name="Linked Event ID")
 
    def __str__(self):
        return self.name
    
    
    
    
.
class price(models.Model):
    id                          = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False, verbose_name="PriceRecordID")
    productid                   = models.ForeignKey(to=products, on_delete=models.CASCADE)
    price                       = models.FloatField(verbose_name="price")
    date_from                   = models.DateField(verbose_name="Date From")
    date_to                     = models.DateField(verbose_name="Date To")
    
    @property
    def status(self):
        today = datetime.date.today()
        if today in (self.date_to, self.date_from):
            return True
        else: return False

        
class bundle(models.Model):
    id                          = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False)
    name                        = models.CharField(max_length=255, verbose_name="Product Name")
    productsinbunble            = models.ManyToManyField(products)
    date_from                   = models.DateField(verbose_name="Date To")
    date_to                     = models.DateField(verbose_name="Date From")
    discount                    = models.FloatField(verbose_name="Discount")
    
    def __str__(self):
        return self.name

enter image description here

Back to Top