我需要按 date_created 对查询集进行排序
class Order(models.Model): STATUS = ( ('退货', '退货'), ('待发货', '待发货'), ('已发货', '已发货'), ('新订单' , '新订单'), ('持有', '持有'),
)
user = models.ForeignKey(User,on_delete=models.CASCADE, null=True, blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True , choices=STATUS, default='new order',blank=True)
note = models.CharField(max_length=1000, null=True,blank=True)
receiver_name= models.CharField(max_length=100)
receiver_address= models.CharField(max_length=200)
receiver_phone = models.CharField(max_length=50)
order_number = models.CharField(max_length=50)
condition= models.IntegerField(blank=True,default=0,null=True)
delivery_cost = models.IntegerField(default=60,null=True,blank=True)
def __str__(self):
return self.user.username
强调文字
all_order = Order.objects.exclude(status='新订单').order_by('order_date1')
天涯尽头无女友
相关分类