I had the need for a CharField which stores the values always in uppercase form. Is there a solution out there ?
Maybe the follwing simple generic solution would be fine:
class UpperCase(models.Model):
uppercase_field = models.CharField(maxlenght=10, uppercase=True)
Regards,
Dirk
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
For now you can override "save" method of the model:
def save(self):
self.uppercase_field = self.uppercase_field.upper()
super(MyModel, self).save()
Ivan's suggestino of adding a custom save() method on the model which
uppercases the contents of the field you want uppercased is probably
your best bet; trying to add model fields and options for every type
of constraint people might want would unnecessarily complicate the
model system, especially when we've already got ways to handle that
sort of thing.
--
"May the forces of evil become confused on the way to your house."
-- George Carlin