When overwriting, the save() method is a valid solution. I found it helpful to deal with this at the Field level and not at the Model level by rewriting get_prep_value() .
Thus, if you ever want to reuse this field in a different model, you can use the same consistent strategy. The logic is also separate from the save method, which you can also overwrite for different purposes.
For this case, you would do this:
class NameField(models.CharField): def __init__(self, *args, **kwargs): super(NameField, self).__init__(*args, **kwargs) def get_prep_value(self, value): return str(value).lower() class User(models.Model): username = models.CharField(max_length=100, unique=True) password = models.CharField(max_length=64) name = NameField(max_length=200) phone = models.CharField(max_length=20) email = models.CharField(max_length=200)
Danil
source share