title: How to store a dictionary in a Django database model's field
body: <p>I need to save a dictionary in a model's field. How do I do that?</p>
  
  <p>For example I have this code:</p>
  
  <pre><code>def create_random_bill(self):
      name_chars = re.compile("[a-zA-Z0-9 -_]")
      bill_name = "".join(random.choice(name_chars for x in range(10)))
      rand_products = random.randint(1,100)
      for x in rand_products:
          bill_products = 
      new_bill = Bill.new(name=bill_name, date=datetime.date, products=bill_products)
      new_bill.save()
  </code></pre>
  
  <p>What do I write for "bill_products=" so it saves some random products, from my Product model to this bill?</p>
  
  <p>This is the bill's model description:</p>
  
  <pre><code>class Bill(models.Model):
      name = models.CharField(max_length=255)
      date = models.DateTimeField(auto_now_add=True)
      products = models.ManyToManyField(Product, related_name="bills")
  </code></pre>
  
  <p>And also the product's model description:</p>
  
  <pre><code>class Product(models.Model):
      name = models.CharField(max_length=255)
      price = models.IntegerField()
  </code></pre>
  
  <p>If there's anything else i should add just leave a comment. Thanks!</p>