title: Django - How to use the model method in a fuction based view
body: <p>I have created a function that sums all amounts in a model.</p>
  
  <p>How can I execute this function(get_tot_order_price) in a function based view(FBV)?</p>
  
  <p>def myview(request):
     ???</p>
  
  <pre><code>class Cart(TimeStampedModel, models.Model):
  
      user = models.ForeignKey(settings.AUTH_USER_MODEL,
                           on_delete=models.CASCADE)
      product = models.ForeignKey(Product, on_delete=models.CASCADE)
      quantity = models.IntegerField(default=1)
      paid = models.BooleanField(default=False)
  
  
      def get_price(self):
          return self.product.price * self.quantity
  
  
  class BillingItem(models.Model):
  
      user = models.ForeignKey(settings.AUTH_USER_MODEL,
                           on_delete=models.PROTECT)
      products = models.ManyToManyField(Cart)
      quantity = models.PositiveIntegerField()
  
      def __str__(self):
          return '{}'.format(self.id)
  
      def get_tot_order_price(self):
          total = 0
          for price in self.products.all():
              total += price.get_price()
  
          return total
  </code></pre>