Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (20 sloc) 0.685 kb
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=255)
class Meta:
verbose_name_plural = 'Categories'
def __unicode__(self):
return self.name
class SubCategory(models.Model):
category = models.ForeignKey('Category')
name = models.CharField(max_length=255)
class Meta:
verbose_name = 'Sub-Category'
verbose_name_plural = 'Sub-Categories'
def __unicode__(self):
return self.name
class Product(models.Model):
name = models.SlugField(max_length=255)
subcategory = models.ForeignKey(SubCategory)
def __unicode__(self):
return self.name.title()
Jump to Line
Something went wrong with that request. Please try again.