Created
August 22, 2013 10:02
-
-
Save spapas/6305393 to your computer and use it in GitHub Desktop.
Sample django models
This file contains 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 Category(models.Model): | |
name = models.CharField() | |
class Attribute(models.Model): | |
category = models.ForeignKey(Category) | |
name = models.CharField | |
class Item(models.Model): | |
slug = models.SlugField() | |
price = models.DecimalField() | |
remaining = models.IntegerField() | |
category = models.ForeignKey(Category) | |
description = models.CharField() | |
attributes = models.ManyToManyField(Attribute, through='ItemAttribute') | |
class ItemAttribute(models.Model): | |
item= models.ForeignKey(Item) | |
attribute = models.ForeignKey(Attribute) | |
value = models.CharField() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment