title: CharField with fixed length, how?
body: <p>I wold like to have in my model a CharField with fixed length. In other words I want that only a specified length is valid.</p>
  <p>I tried to do something like</p>
  <pre><code>volumenumber = models.CharField('Volume Number', max_length=4, min_length=4)
  </code></pre>
  <p>but it gives me an error (it seems that I can use both max_length and min_length at the same time).</p>
  <p>Is there another quick way?</p>
  <p>My model is this:</p>
  <pre><code>class Volume(models.Model):
      vid = models.AutoField(primary_key=True)
      jid = models.ForeignKey(Journals, db_column='jid', null=True, verbose_name = &quot;Journal&quot;)
      volumenumber = models.CharField('Volume Number')
      date_publication = models.CharField('Date of Publication', max_length=6, blank=True)
      class Meta:
          db_table = u'volume'
          verbose_name = &quot;Volume&quot;
          ordering = ['jid', 'volumenumber']
          unique_together = ('jid', 'volumenumber')
      def __unicode__(self):
          return (str(self.jid) + ' - ' + str(self.volumenumber))
  </code></pre>
  <p>What I want is that the <code>volumenumber</code> must be exactly 4 characters.</p>
  <p>I.E.
  if someone insert '4b' django gives an error because it expects a string of 4 characters.</p>
  <p>So I tried with</p>
  <pre><code>volumenumber = models.CharField('Volume Number', max_length=4, min_length=4)
  </code></pre>
  <p>but it gives me this error:</p>
  <pre><code>Validating models...
  Unhandled exception in thread started by &lt;function inner_run at 0x70feb0&gt;
  Traceback (most recent call last):
    File &quot;/Library/Python/2.5/site-packages/django/core/management/commands/runserver.py&quot;, line 48, in inner_run
      self.validate(display_num_errors=True)
    File &quot;/Library/Python/2.5/site-packages/django/core/management/base.py&quot;, line 249, in validate
      num_errors = get_validation_errors(s, app)
    File &quot;/Library/Python/2.5/site-packages/django/core/management/validation.py&quot;, line 28, in get_validation_errors
      for (app_name, error) in get_app_errors().items():
    File &quot;/Library/Python/2.5/site-packages/django/db/models/loading.py&quot;, line 131, in get_app_errors
      self._populate()
    File &quot;/Library/Python/2.5/site-packages/django/db/models/loading.py&quot;, line 58, in _populate
      self.load_app(app_name, True)
    File &quot;/Library/Python/2.5/site-packages/django/db/models/loading.py&quot;, line 74, in load_app
      models = import_module('.models', app_name)
    File &quot;/Library/Python/2.5/site-packages/django/utils/importlib.py&quot;, line 35, in import_module
      __import__(name)
    File &quot;/Users/Giovanni/src/djangoTestSite/../djangoTestSite/journaldb/models.py&quot;, line 120, in &lt;module&gt;
      class Volume(models.Model):
    File &quot;/Users/Giovanni/src/djangoTestSite/../djangoTestSite/journaldb/models.py&quot;, line 123, in Volume
      volumenumber = models.CharField('Volume Number', max_length=4, min_length=4)
  TypeError: __init__() got an unexpected keyword argument 'min_length'
  </code></pre>
  <p>That obviously doesn't appear if I use only &quot;max_length&quot; OR &quot;min_length&quot;.</p>
  <p>I read the documentation on the django web site and it seems that I'm right (I cannot use both together) so I'm asking if there is another way to solve the problem.</p>