add: add order api
This commit is contained in:
@@ -1,3 +1,30 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
from core.apps.common.models import BaseModel
|
||||
from core.apps.accounts.models import User
|
||||
|
||||
|
||||
class Order(BaseModel):
|
||||
STATUS = (
|
||||
('Yetkazilmoqda', 'Yetkazilmoqda'),
|
||||
('Olingan', 'Olingan'),
|
||||
('Kutilmoqda', 'Kutilmoqda'),
|
||||
('Yetkazib berilgan', 'Yetkazib berilgan')
|
||||
)
|
||||
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='orders')
|
||||
name = models.CharField(max_length=200)
|
||||
date = models.DateField()
|
||||
status = models.CharField(max_length=20, choices=STATUS)
|
||||
size = models.CharField(max_length=20)
|
||||
total_price = models.PositiveBigIntegerField()
|
||||
is_paid = models.BooleanField(default=False)
|
||||
location = models.CharField(max_length=200)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.user} user order {self.name}'
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Buyurtma'
|
||||
verbose_name_plural = 'buyurtmalar'
|
||||
|
||||
Reference in New Issue
Block a user