Skip to content

Commit cf7b109

Browse files
26.8
1 parent bf79835 commit cf7b109

File tree

8 files changed

+12
-15
lines changed

8 files changed

+12
-15
lines changed
8.99 KB
Binary file not shown.
9 Bytes
Binary file not shown.
Binary file not shown.

store/management/commands/setup_fake_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,3 @@ def handle(self, *args, **kwargs):
123123
)
124124
all_cart_items.append(cart_item)
125125
print('DONE')
126-
127-
128-

store/migrations/0001_initial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.2.7 on 2025-10-27 15:57
1+
# Generated by Django 5.2.7 on 2025-11-01 13:23
22

33
import django.db.models.deletion
44
from django.db import migrations, models
@@ -34,7 +34,7 @@ class Migration(migrations.Migration):
3434
name='Category',
3535
fields=[
3636
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
37-
('name', models.CharField(max_length=255)),
37+
('title', models.CharField(max_length=255)),
3838
('description', models.CharField(blank=True, max_length=500)),
3939
('detetime_created', models.DateTimeField(auto_now_add=True)),
4040
],
@@ -72,7 +72,7 @@ class Migration(migrations.Migration):
7272
('name', models.CharField(max_length=255)),
7373
('slug', models.SlugField()),
7474
('description', models.TextField()),
75-
('price', models.DecimalField(decimal_places=2, max_digits=6)),
75+
('unit_price', models.DecimalField(decimal_places=2, max_digits=6)),
7676
('inventory', models.IntegerField(default=0)),
7777
('datetime_created', models.DateTimeField(auto_now_add=True)),
7878
('datetime_modified', models.DateTimeField(auto_now=True)),
@@ -101,7 +101,7 @@ class Migration(migrations.Migration):
101101
fields=[
102102
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
103103
('quantity', models.PositiveSmallIntegerField()),
104-
('price', models.DecimalField(decimal_places=2, max_digits=6)),
104+
('unit_price', models.DecimalField(decimal_places=2, max_digits=6)),
105105
('order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='items', to='store.order')),
106106
('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='order_items', to='store.product')),
107107
],
33 Bytes
Binary file not shown.
19 Bytes
Binary file not shown.

store/models.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class 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

Comments
 (0)