mysql数据库_serialisers
时间:2021-07-01 10:21:17
帮助过:6人阅读
rest_framework
import serializers
from .models
import Coupon, UserCoupon
class CouponModelSerializer(serializers.ModelSerializer):
class Meta:
model =
Coupon
fields = (
"name",
"coupon_type",
"condition",
"sale")
class UserCouponModelSerializer(serializers.ModelSerializer):
coupon =
CouponModelSerializer()
class Meta:
model =
UserCoupon
fields = (
"id",
"start_time",
"end_time",
"now_time",
"coupon")
mysql数据库_serialisers
标签:end art pre 创建序列 field time rest ram start