33
44
55class Category (models .Model ):
6- name = models .CharField (max_length = 255 )
6+ title = models .CharField (max_length = 255 )
77 description = models .CharField (max_length = 500 , blank = True )
88 detetime_created = models .DateTimeField (auto_now_add = True )
99 top_product = models .ForeignKey ('Product' , on_delete = models .SET_NULL , null = True , related_name = '+' )
@@ -24,7 +24,7 @@ class Product(models.Model):
2424 category = models .ForeignKey (Category , on_delete = models .PROTECT , related_name = 'products' )
2525 slug = models .SlugField ()
2626 description = models .TextField ()
27- price = models .DecimalField (max_digits = 6 ,decimal_places = 2 )
27+ unit_price = models .DecimalField (max_digits = 6 ,decimal_places = 2 )
2828 inventory = models .IntegerField (default = 0 )
2929 datetime_created = models .DateTimeField (auto_now_add = True )
3030 datetime_modified = models .DateTimeField (auto_now = True )
@@ -74,7 +74,7 @@ class OrderItem(models.Model):
7474 order = models .ForeignKey (Order , on_delete = models .PROTECT , related_name = 'items' )
7575 product = models .ForeignKey (Product , on_delete = models .PROTECT , related_name = 'order_items' )
7676 quantity = models .PositiveSmallIntegerField ()
77- price = models .DecimalField (max_digits = 6 , decimal_places = 2 )
77+ unit_price = models .DecimalField (max_digits = 6 , decimal_places = 2 )
7878
7979 class Meta :
8080 unique_together = [['order' , 'product' ]]
@@ -112,17 +112,17 @@ class Comment(models.Model):
112112 # One Many
113113 product = models .ForeignKey (Product , on_delete = models .CASCADE , related_name = 'comments' )
114114 COMMENT_STATUS_WAITING = 'w'
115- COMMENT_STATUS_APROVED = 'a'
116- COMMENT_STATUS_NOT_APROCED = 'na'
115+ COMMENT_STATUS_APPROVED = 'a'
116+ COMMENT_STATUS_NOT_APPROVED = 'na'
117117 COMMENT_STATUS = [
118118 (COMMENT_STATUS_WAITING ,'Waiting' ),
119- (COMMENT_STATUS_APROVED ,'Approved' ),
120- (COMMENT_STATUS_NOT_APROCED ,'Not Approved' ),
119+ (COMMENT_STATUS_APPROVED ,'Approved' ),
120+ (COMMENT_STATUS_NOT_APPROVED ,'Not Approved' ),
121121 ]
122122 name = models .CharField (max_length = 255 )
123123 body = models .TextField ()
124124 datetime_created = models .DateTimeField (auto_now_add = True )
125- status = models .CharField (max_length = 2 , choices = COMMENT_STATUS , default = COMMENT_STATUS_NOT_APROCED )
125+ status = models .CharField (max_length = 2 , choices = COMMENT_STATUS , default = COMMENT_STATUS_NOT_APPROVED )
126126
127127
128128
0 commit comments