django charfield force lowercase

Solutions on MaxInterview for django charfield force lowercase by the best coders in the world

showing results for - "django charfield force lowercase"
Angela
17 Jul 2017
1# Just do it in the save method. ie, override the save method of Model class.
2
3def save(self, *args, **kwargs):
4    self.username = self.username.lower()
5    return super(User, self).save(*args, **kwargs)