表结构
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey,GenericRelation
# Create your models here.
class BigCourse(models.Model):
"""大课"""
name = models.CharField(max_length=128)
# 不会创建额外列,帮助你快速操作
price_policy = GenericRelation("PricePolicy")
class SmallCourse(models.Model):
"""小课"""
name = models.CharField(max_length=128)
class PricePolicy(models.Model):
"""价格策略"""
period = models.IntegerField(verbose_name='
标签:models,price,object,Django,content,contenttypes,objects,PricePolicy,组件
From: https://www.cnblogs.com/fuminer/p/16861873.html