Browse Source

using DecimalField instead of IntegerField for currency amounts

master
Frederic 11 years ago
parent
commit
6f570d203d
  1. 8
      cash/models.py

8
cash/models.py

@ -10,7 +10,7 @@ class Account(models.Model): @@ -10,7 +10,7 @@ class Account(models.Model):
null=True)
pin = models.CharField(max_length=32, blank=True)
daily_digest = models.BooleanField()
credit = models.IntegerField(default=0)
credit = models.DecimalField(max_digits=5, decimal_places=2, default=0)
def __unicode__(self):
return self.user.username
@ -65,7 +65,7 @@ class ProductCategory(models.Model): @@ -65,7 +65,7 @@ class ProductCategory(models.Model):
class Product(models.Model):
name = models.CharField(max_length=32, unique=True)
price = models.IntegerField()
price = models.DecimalField(max_digits=5, decimal_places=2)
deleted = models.BooleanField()
category = models.ForeignKey(ProductCategory, blank=True, null=True)
@ -85,13 +85,13 @@ class Transaction(models.Model): @@ -85,13 +85,13 @@ class Transaction(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
subject = models.CharField(max_length=32)
description = models.TextField()
amount = models.IntegerField()
amount = models.DecimalField(max_digits=5, decimal_places=2)
class SalesLogEntry(models.Model):
account = models.ForeignKey(Account)
product = models.ForeignKey(Product)
count = models.IntegerField()
unit_price = models.IntegerField()
unit_price = models.DecimalField(max_digits=5, decimal_places=2)
timestamp = models.DateTimeField(auto_now_add=True)

Loading…
Cancel
Save