Created
September 24, 2012 12:45
-
-
Save ikks/3775774 to your computer and use it in GitHub Desktop.
Cart Sale Model Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CartSale(models.Model): | |
first_name = models.CharField( | |
max_length=100, | |
) | |
last_name = models.CharField( | |
max_length=100, | |
) | |
date_sale = models.DateTimeField( | |
auto_now_add=True, | |
) | |
email = models.EmailField() | |
class CartProduct(models.Model): | |
upc = models.CharField( | |
max_length=100, | |
) | |
cartsale = models.ForeignKey( | |
CartSale, | |
related_name='products', | |
) | |
quantity = models.IntegerField() | |
price = models.DecimalField( | |
max_digits=8, | |
decimal_places=2, | |
) | |
product_detail = models.ForeignKey( | |
ProductDetail, | |
) | |
class Product(models.Model): | |
name = models.CharField( | |
max_length=30, | |
) | |
reference = models.CharField( | |
max_length=30, | |
) | |
class ProductDetail(models.Model): | |
price = models.DecimalField( | |
max_digits=8, | |
decimal_places=2, | |
) | |
quantity = models.PositiveIntegerField( | |
blank=True, | |
default=0, | |
) | |
upc = models.CharField( | |
max_length=100, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment