📜  django charfield 强制小写 - Python 代码示例

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

代码示例1
# Just do it in the save method. ie, override the save method of Model class.

def save(self, *args, **kwargs):
    self.username = self.username.lower()
    return super(User, self).save(*args, **kwargs)