📜  Django 抽象基类 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:42.009000             🧑  作者: Mango

代码示例1
from django.db import models

class CommonInfo(models.Model):
    name = models.CharField(max_length=100)
    age = models.PositiveIntegerField()

    class Meta:
        abstract = True

class Student(CommonInfo):
    home_group = models.CharField(max_length=5)