title: Get the values from one app to another in Django
body: <p>I am working on creating shopping cart. I am still in learning phase. I need to know how I can pass/use values from shop's models.py to cart's cart.py.</p>
  
  <p>shop/models.py</p>
  
  <pre><code>class Product(models.Model):
  
      delivery_price = models.DecimalField(max_digits=10, decimal_places=0,default=0)
      support_price = models.DecimalField(max_digits=10, decimal_places=0,default=0) 
  </code></pre>
  
  <p>cart/cart.py : I think this is the file where I need to get delivery_price and support_price.  I dont know how I can get these two values. I want to add these prices and multiply it by quantity (something like <code>Product.delivery_price + Product.support_price * item.quantity</code> -> not sure about the way this is being done) How is this flow working? If anyone help me understand, it would be great. </p>
  
  <pre><code>class Cart(object):
      def __init__(self, request):
  
      def add(self, product, quantity=1,update_quantity=False, support_req=False):
          """
          Add a product to the cart or update its quantity.
          """
          product_id = str(product.id)
          if product_id not in self.cart:
              self.cart[product_id] = {'quantity': 0,
  
                                       'price': str(product.price)}
          if update_quantity:
              self.cart[product_id]['quantity'] = quantity
          else:
              self.cart[product_id]['quantity'] += quantity
          self.save()
  
      def __iter__(self):
          """
          Iterate over the items in the cart and get the products
          from the database.
          """
          product_ids = self.cart.keys()
          # get the product objects and add them to the cart
          products = Product.objects.filter(id__in=product_ids)
          for product in products:
              self.cart[str(product.id)]['product'] = product
  
          for item in self.cart.values():
  
              item['price'] = Decimal(item['price'])
              item['total_price'] = item['price'] * item['quantity']
  
              yield item
  
      def __len__(self):
          """
          Count all items in the cart.
          """
          return sum(item['quantity'] for item in self.cart.values())
  
      def get_total_price(self):
          return sum(Decimal(item['price']) * item['quantity'] for item in self.cart.values())
  </code></pre>
  
  <p>I used code from <a href="https://github.com/twtrubiks/django-shop-tutorial" rel="nofollow noreferrer">https://github.com/twtrubiks/django-shop-tutorial</a></p>