title: Calculate a number in a Django model from another model's data
body: <p>I want to take data (<code>amount_spent</code>) from the field of each user and add those numbers up and display them in another field (<code>total_revenue</code>) from a different model (<code>RevenueInfo</code>). </p>
  
  <pre><code>from __future__ import unicode_literals
  from django.contrib.auth.models import User
  from django.db import models
  from django import forms, views
  
  # Create your models here.
  #LoginInfo is being used, LoginForms in forms.py is
  class LoginInfo(models.Model):
      username = models.CharField('', max_length=10)
      password = models.CharField('', max_length=15)
  
  class ExtendedProfile(models.Model):
      user = models.OneToOneField(User)
      amount_spent = models.DecimalField(max_digits=6, decimal_places=2)
  
  class RevenueInfo(models.Model):
      total_amount_spent = models.DecimalField(max_digits=6, decimal_places=2, default=0)
      total_revenue = models.ForeignKey(ExtendedProfile, null=True)
  
  class Product(models.Model):
       category = models.CharField(max_length=100)
       name = models.CharField(max_length=100)
       description = models.TextField()
       #photo = models.ImageField()
       price_CAD = models.DecimalField(max_digits=6, decimal_places=2)
       quantity = models.DecimalField(max_digits=2, decimal_places=0, null=True)
  </code></pre>
  
  <p>How could I go about this? Would I iterate of each <code>User</code>model and find <code>User.amount_spent</code> then add that to <code>RevenueInfo.total_revenue</code>? I'm not sure how to put that into code. Also I'm pretty sure I don't need both <code>total_amount_spent</code> and <code>total_revenue</code> but I feel like I need a <code>ForeignKey</code></p>