If you want that behavior, just truncate `myfield` in `MyModel.save()`
before calling the super save.
<http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.save>
--
George
As noted elsewhere in the thread, truncating would be almost always the
wrong solution, since it quietly throws away data.
As for detecting the problem in the first place, form fields will
already pick up this problem if the user is providing data through a
form (it will be a validation error). Right now, model field validation
doesn't exist, so you, as the programmer populating the field, is
expected to make sure the data fits (in the above example, you're
populating the model field directly, so you need to check you're
populating it with something sensible). In fact, even after model field
validation exists, it will still be your responsibility to make sure the
data fits: Django will raise a validation error if it doesn't, but it
won't automatically fix the problem because an appropriate solution is
going to be domain specific.
Regards,
Malcolm