вооо!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class SubType(models.Model) :
roottype = models.ForeignKey('SubType',null=True,blank=True)
title = models.CharField('Название категории',max_length=255,null=False,blank=False,)
class Meta:
verbose_name_plural = "Категории"
verbose_name = "Категория"
def __unicode__(self):
return self.title
class Product(models.Model):
category = models.ForeignKey('Subtype',null=False,blank=False)
title = models.CharField('Название продукта',max_length=255,null=False,blank=False,)
description = models.TextField('Описание продукта',null=False,blank=False)
class Meta:
verbose_name_plural = "Продукция"
verbose_name = "Продукт"
def __unicode__(self):
return self.title