码迷,mamicode.com
首页 > 其他好文 > 详细

天天生鲜order.model.py

时间:2019-01-06 21:10:18      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:comment   微信支付   地址   mode   erb   支付   add   订单   efault   

from django.db import models
from db.base_model import BaseModel
# Create your models here.


class OrderInfo(BaseModel):
    ‘‘‘订单模型类‘‘‘
    PAY_METHOD_CHOICES = (
        (1, 货到付款),
        (2, 微信支付),
        (3, 支付宝),
        (4, 银联支付)
    )

    ORDER_STATUS_CHOICES = (
        (1, 待支付),
        (2, 待发货),
        (3, 待收货),
        (4, 待评价),
        (5, 已完成)
    )

    order_id = models.CharField(max_length=128, primary_key=True, verbose_name=订单id)
    user = models.ForeignKey(user.User, verbose_name=用户)
    addr = models.ForeignKey(user.Address, verbose_name=地址)
    pay_method = models.SmallIntegerField(choices=PAY_METHOD_CHOICES, default=3, verbose_name=支付方式)
    total_count = models.IntegerField(default=1, verbose_name=商品数量)
    total_price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name=商品总价)
    transit_price = models.DecimalField(max_digits=10, decimal_places=2,verbose_name=订单运费)
    order_status = models.SmallIntegerField(choices=ORDER_STATUS_CHOICES, default=1, verbose_name=订单状态)
    trade_no = models.CharField(max_length=128, verbose_name=支付编号)

    class Meta:
        db_table = df_order_info
        verbose_name = 订单
        verbose_name_plural = verbose_name


class OrderGoods(BaseModel):
    ‘‘‘订单商品模型类‘‘‘
    order = models.ForeignKey(OrderInfo, verbose_name=订单)
    sku = models.ForeignKey(goods.GoodsSKU, verbose_name=商品SKU)
    count = models.IntegerField(default=1, verbose_name=商品数目)
    price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name=商品价格)
    comment = models.CharField(max_length=256, verbose_name=评论)

    class Meta:
        db_table = df_order_goods
        verbose_name = 订单商品
        verbose_name_plural = verbose_name

 

天天生鲜order.model.py

标签:comment   微信支付   地址   mode   erb   支付   add   订单   efault   

原文地址:https://www.cnblogs.com/myiuni/p/10230321.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!