from django db import models class Brand models Model title models Cha

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.db import models
class Brand(models.Model):
title = models.CharField(max_length=40)
class Admin:
list_display = ('title',)
class Meta:
verbose_name = 'Brand'
verbose_name_plural = 'Brands'
def __unicode__(self):
return self.title
class Products(models.Model):
name = models.CharField(max_length=40)
brand = models.ManyToManyField(Brand)
description = models.TextField()
price = models.IntegerField(Brand)
class Admin:
list_display = ('name',)
class Meta:
verbose_name = 'Product'
verbose_name_plural = 'Products'
def __unicode__(self):
return self.name