change order api

This commit is contained in:
behruz-dev
2025-09-04 16:47:43 +05:00
parent da94330701
commit 7d31a6a512
5 changed files with 100 additions and 9 deletions

View File

@@ -6,18 +6,27 @@ from core.apps.products.models import Product
class Order(BaseModel):
STATUS = (
('PENDING', 'kutilmoqda'),
('PROCESSING', 'qayta ishlash'),
('SHIPPED', "jo'natilgan"),
('DELIVERED', 'yetkazib berildi'),
('CANCELLED', 'bekor qilingan')
PAYMENT_TYPE = (
('CASH', 'naqd'),
('CARD', 'card'),
('ACCOUNT_NUMBER', 'hisob raqam'),
)
DELIVERY_TYPE = (
('YandexGo', 'YandexGo'),
('DELIVERY_COURIES', 'kuryer orqali yetkazib berish'),
('PICKUP', 'olib ketish'),
)
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, default='kutilmoqda')
payment_type = models.CharField(max_length=20, choices=PAYMENT_TYPE, null=True)
delivery_type = models.CharField(max_length=200, choices=DELIVERY_TYPE, null=True)
delivery_price = models.PositiveBigIntegerField(default=0)
contact_number = models.CharField(max_length=15, null=True, blank=True)
address = models.TextField(null=True, blank=True)
comment = models.CharField(max_length=500, null=True, blank=True)
name = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return f'{self.user} order'