title: Django Integer and Decimal field multiplication
body: <p>I'm trying to figure out how to multiply a decimal field value by an integer field value.</p>
  
  <p>Here is my model:</p>
  
  <pre><code>class OrderItem(models.Model):
      order = models.ForeignKey(Order, editable=False)
      product = models.ForeignKey('products.Product')
      qty = models.IntegerField()
      original_price = models.DecimalField(max_digits=20, decimal_places=2)
      sale_price = models.DecimalField(max_digits=20, decimal_places=2)
      tax = models.DecimalField(max_digits=20, decimal_places=2)
      total = models.DecimalField(max_digits=2, decimal_places=2, null=True, blank=True, editable=False)
      total_tax = models.DecimalField(max_digits=2, decimal_places=2, null=True, blank=True, editable=False)
      picked = models.IntegerField(null=True, blank=True)
      user = models.ForeignKey('auth.User', editable=False)
      created = models.DateTimeField(auto_now_add=True)
      modified = models.DateTimeField(auto_now=True)
  </code></pre>
  
  <p>I'm trying to multiple the "sale_price" column by the "qty" column but get the following error:</p>
  
  <pre><code>Invalid literal for Decimal: u'180.00180.00'
  </code></pre>
  
  <p>Using this code:</p>
  
  <pre><code>def orderItemPs(sender, instance=False, **kwargs):
      #figure out the total
      instance.total = decimal.Decimal(int(instance.qty) * instance.sale_price)
      instance.total_tax = decimal.Decimal(int(instance.qty) * instance.tax)
      #disconnect
      post_save.disconnect(orderItemPs, sender=OrderItem)
      instance.save()
      #reconnect
      post_save.connect(orderItemPs, sender=OrderItem)
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong.</p>
  
  <p>Cheers,
  Sn0rcha!</p>
  
  <p><strong>UPDATE:</strong> Further information.</p>
  
  <p>I've changed the code that was triggering off the post_save function to the following.</p>
  
  <pre><code>order_item = OrderItem(order=form, product=Product.objects.get(pk=products[i]), qty=int(qtys[i]), original_price=decimal.Decimal(original_prices[i]), tax=decimal.Decimal(taxs[i]), user=request.user, sale_price=decimal.Decimal(sale_prices[i]))
  </code></pre>
  
  <p>to make sure I'm casting the form values correctly prior to saving the model. I changed the 2 lines in the post save function to:</p>
  
  <pre><code>instance.total = decimal.Decimal(instance.qty * instance.sale_price)
  instance.total_tax = decimal.Decimal(instance.qty * instance.tax)
  </code></pre>
  
  <p>However now I get the error:</p>
  
  <pre><code>quantize result has too many digits for current context
  </code></pre>
  
  <p>I'm using POSTGres not that it's an error on it's end.</p>