Ticket #9864: version-error-msg.diff
File version-error-msg.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/db/backends/mysql/validation.py
16 16 varchar_fields = (models.CharField, models.CommaSeparatedIntegerField, 17 17 models.SlugField) 18 18 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".' 19 23 if db_version < (5, 0, 3): 20 24 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 = None25 25 26 26 if msg: 27 27 errors.add(opts, msg % {'name': f.name, 'cls': f.__class__.__name__, 'version': '.'.join([str(n) for n in db_version[:3]])})