title: Auto-truncating fields at max_length in Django CharFields
body: <p>I have a field that has a <code>max_length</code> set. When I save a model instance, and the field's value is greater than <code>max_length</code>, Django enforces that <code>max_length</code> at the database level. (See Django docs on models: <a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.CharField.max_length" rel="noreferrer">http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.CharField.max_length</a>)</p>
  
  <p>However, since I am using Postgres, I receive a <code>DatabaseError</code> exception like this:</p>
  
  <pre><code>DatabaseError: value too long for type character varying(1000)
  </code></pre>
  
  <p>I would prefer to instead auto-truncate the value (so I don't have an exception). Now, I can do this manually, but what I would really want is to have all of my models auto-truncate the value. (Not necessarily intelligently. Just cutting it off at the 999th character is fine.) </p>
  
  <p>Should I just write a custom class that imports from models.Model and override the save() method, looping through each _meta.field, checking for the max_length, and then truncating? That seems inelegant and there must be a better way.</p>