Created
January 12, 2011 02:51
-
-
Save alexcabrera/775610 to your computer and use it in GitHub Desktop.
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 StockItemAttribute(models.Model): | |
| name = models.CharField(max_length=80) | |
| slug = models.SlugField(unique=True) | |
| help_text = models.TextField(null=True, blank=True) | |
| def __unicode__(self): | |
| return _(self.name) | |
| class StockItemAttributeValue(models.Model): | |
| stock_item = models.ForeignKey('StockItem', related_name='attribute_values') | |
| attribute = models.ForeignKey('StockItemAttribute') | |
| value = models.CharField(max_length=255) | |
| unit = models.CharField(max_length=8, choices=ATTRIBUTE_VALUE_UNITS, null=True, blank=True) | |
| def __unicode__(self): | |
| return "%s %s" % (self.value, self.unit) | |
| def display_value(self): | |
| return "%s %s" % (self.value, self.unit) | |
| class StockItem(models.Model): | |
| package_title = models.CharField(max_length=60, blank=True, null=True, help_text='(ex. 3-pack of T-shirts)', default='Individual Item') | |
| package_count = models.IntegerField(default=1) | |
| inventory = models.IntegerField(default=0) | |
| price = models.DecimalField( | |
| max_digits=10, | |
| decimal_places=2, | |
| help_text='All prices in USD. Use this field to override the standard pricing of a product for this sepcific stock item.', | |
| blank=True, | |
| null=True, | |
| ) | |
| on_sale = models.BooleanField(default=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment