0

I am trying to create a simple e-auction platform. I have models for customers where i want to store a list of all the items they have bid on and the exact amount they have bid on.

class Company(models.Model):
name = models.CharField(max_length=256)
    contact_person_name = models.CharField(max_length=256)
    contact_no = PhoneNumberField()

class Customer(models.Model):
    name = models.CharField(max_length=256)
    company_name = models.ForeignKey(Company, on_delete=models.CASCADE)

And then i have a model for my catalogue where i wish to store a list of bidders on a particular catalog and their current bid.

class Catalogue(models.Model):
    name = models.CharField(max_length=512)
    owner = models.ForeignKey(Customer, on_delete=models.CASCADE)
    start_date = models.DateTimeField()
    end_date = models.DateTimeField()
    start_price = models.PositiveIntegerField()
    bidders = models.ManytoManyField(Customer)

But how do i store the exact amount a customer has bid on a catalogue item?

  • 2
    Does this answer your question? [Django's ManyToMany Relationship with Additional Fields](https://stackoverflow.com/questions/4443190/djangos-manytomany-relationship-with-additional-fields) – Abdul Aziz Barkat Jun 01 '22 at 15:56

0 Answers0