Django/Python update field values (during model save)
问题 I am trying to capitalize a number of fields in my django models, when they are saved. Looking at this question, which had this answer: class Blog(models.Model): name = models.CharField(max_length=100) def save(self): self.name = self.name.title() super(Blog, self).save() This works fine, however, in each save, this requires some extra typing, if I want to repeat this multiple times. So I would like to create a function that takes fields as an input and re-saves them as uppercase, during the