Ticket #9864: version-error-msg.diff

File version-error-msg.diff, 1.1 KB (added by ElliottM, 16 years ago)
  • django/db/backends/mysql/validation.py

     
    1616        varchar_fields = (models.CharField, models.CommaSeparatedIntegerField,
    1717                models.SlugField)
    1818        if isinstance(f, varchar_fields) and f.max_length > 255:
     19            msg=None
     20
     21            if f.unique == True:
     22                msg = '"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when using "unique=True".'
    1923            if db_version < (5, 0, 3):
    2024                msg = '"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %(version)s).'
    21             if f.unique == True:
    22                 msg = '"%(name)s": %(cls)s cannot have a "max_length" greater than 255 when using "unique=True".'
    23             else:
    24                 msg = None
    2525
    2626            if msg:
    2727                errors.add(opts, msg % {'name': f.name, 'cls': f.__class__.__name__, 'version': '.'.join([str(n) for n in db_version[:3]])})
Back to Top