浏览代码

Edited MySQL-specific check messages for grammar and consistency.

Russell Keith-Magee 11 年之前
父节点
当前提交
f7587b20da
共有 2 个文件被更改,包括 4 次插入6 次删除
  1. 2 3
      django/db/backends/mysql/validation.py
  2. 2 3
      tests/invalid_models_tests/test_ordinary_fields.py

+ 2 - 3
django/db/backends/mysql/validation.py

@@ -22,11 +22,10 @@ class DatabaseValidation(BaseDatabaseValidation):
                     and (field.max_length is None or int(field.max_length) > 255)):
                 errors.append(
                     checks.Error(
-                        ('Under mysql backend, the field cannot have a "max_length" '
-                         'greated than 255 when it is unique.'),
+                        ('MySQL does not allow unique CharFields to have a max_length > 255.'),
                         hint=None,
                         obj=field,
-                        id='E047',
+                        id='mysql.E001',
                     )
                 )
         return errors

+ 2 - 3
tests/invalid_models_tests/test_ordinary_fields.py

@@ -191,11 +191,10 @@ class CharFieldTests(IsolatedModelsTestCase):
         errors = validator.check_field(field)
         expected = [
             Error(
-                ('Under mysql backend, the field cannot have a "max_length" '
-                 'greated than 255 when it is unique.'),
+                'MySQL does not allow unique CharFields to have a max_length > 255.',
                 hint=None,
                 obj=field,
-                id='E047',
+                id='mysql.E001',
             )
         ]
         self.assertEqual(errors, expected)