add: add order apis for admin panel

This commit is contained in:
behruz-dev
2025-09-03 16:33:05 +05:00
parent c040d6f4c6
commit 1befa6625f
6 changed files with 64 additions and 11 deletions

View File

@@ -6,17 +6,18 @@ from core.apps.products.models import Product
class Order(BaseModel):
# STATUS = (
# ('', ''),
# ('', ''),
# ('', ''),
# ('', ''),
# ('', '')
# )
STATUS = (
('PENDING', 'kutilmoqda'),
('PROCESSING', 'qayta ishlash'),
('SHIPPED', "jo'natilgan"),
('DELIVERED', 'yetkazib berildi'),
('CANCELLED', 'bekor qilingan')
)
total_price = models.PositiveBigIntegerField(default=0)
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='orders')
order_number = models.PositiveBigIntegerField(default=1)
# status = models.CharField(max_length=20, choices=STATUS)
status = models.CharField(max_length=20, choices=STATUS, default='kutilmoqda')
def __str__(self):
return f'{self.user} order'