How to automatically create database table comment information

I know Django4.2 can set comments on columns and tables, I have some model like this:

class BaseModel(Model):
    class Meta:
        abstract = True

class UserModel(BaseModel):

    phone = CharField(max_length=30, default="", verbose_name="手机号")
    kname = CharField(max_length=200, default="", verbose_name="用户名")

Is there anyway let me set BaseModel auto read UserModel’s class comment and set it to table comment in BaseModel’s Meta class ?
:smiley: :smiley: :smiley:

By using _prepare or connecting a signal receiver for the class_prepared signal and only dealing with subclasses of BaseMode you should be able to iterate over cls._meta.local_concrete_fields and set field.db_comment = field.verbose_name

class BaseModel(Model):
    class Meta:
        abstract = True

    def _prepare(cls):
        for field in cls._meta.local_concrete_fields:
            field.db_comment = field.verbose_name

thanks for reply, I don’t want Field’s db_comment, because I can use IDE let all verbose_name become to db_comment.

I want the db_table_comment automatically create, is there some new idea? :rofl: