peewee_moves.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:peewee-moves 作者: timster 项目源码 文件源码
def primary_key(self, name):
        """
        Add a primary key to the model.
        This has some special cases, which is why it's not handled like all the other column types.

        :param name: Name of column.
        :return: None
        """
        pk_field = peewee.PrimaryKeyField(primary_key=True)
        self.model._meta.primary_key = pk_field
        self.model._meta.auto_increment = True
        pk_field.add_to_class(self.model, name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号