Browse Source

implemented __unicode__ for Account, ProductCategory, Product and ProductBarcode

master
Frederic 11 years ago
parent
commit
4a4751290a
  1. 12
      cash/models.py

12
cash/models.py

@ -8,21 +8,33 @@ class Account(models.Model): @@ -8,21 +8,33 @@ class Account(models.Model):
daily_digest = models.BooleanField()
credit = models.IntegerField()
def __unicode__(self):
return self.user.username
class ProductCategory(models.Model):
name = models.CharField(max_length=32, unique=True)
comment = models.CharField(max_length=128, blank=True)
def __unicode__(self):
return "%s (%s)" % (self.name, self.comment)
class Product(models.Model):
name = models.CharField(max_length=32, unique=True)
price = models.IntegerField()
deleted = models.BooleanField()
category = models.ForeignKey(ProductCategory, blank=True, null=True)
def __unicode__(self):
return self.name
class ProductBarcode(models.Model):
barcode = models.CharField(max_length=32, unique=True)
comment = models.CharField(max_length=128)
product = models.ForeignKey(Product)
def __unicode__(self):
return self.barcode
class Transaction(models.Model):
account = models.ForeignKey(Account)
timestamp = models.DateTimeField(auto_now_add=True)

Loading…
Cancel
Save