You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
1.2 KiB

from django.db import models
from django.contrib.auth.models import User
class Account(models.Model):
user = models.OneToOneField(User)
card_number = models.CharField(max_length=32)
pin = models.CharField(max_length=32)
daily_digest = models.BooleanField()
credit = models.IntegerField()
class ProductCategory(models.Model):
name = models.CharField(max_length=32)
comment = models.CharField(max_length=128, blank=True)
class Product(models.Model):
name = models.CharField(max_length=32)
price = models.IntegerField()
deleted = models.BooleanField()
category = models.ForeignKey(ProductCategory, blank=True, null=True)
class ProductBarcode(models.Model):
barcode = models.CharField(max_length=32)
comment = models.CharField(max_length=128)
product = models.ForeignKey(Product)
class Transaction(models.Model):
account = models.ForeignKey(Account)
timestamp = models.DateTimeField(auto_now_add=True)
subject = models.CharField(max_length=32)
description = models.TextField()
amount = models.IntegerField()
class SalesLogEntry(models.Model):
account = models.ForeignKey(Account)
product = models.ForeignKey(Product)
count = models.IntegerField()
unit_price = models.IntegerField()
timestamp = models.DateTimeField(auto_now_add=True)