@@ -1027,7 +1027,7 @@ def _check_db_table_comment(cls):
10271027 f"{ db_connection .display_name } does not support comments on "
10281028 f"tables (db_table_comment)." ,
10291029 obj = cls ,
1030- id = "models.W046 " ,
1030+ id = "models.db_table_comment_unsupported " ,
10311031 warning = True ,
10321032 )
10331033 )
@@ -1071,7 +1071,7 @@ def _check_m2m_through_same_relationship(cls):
10711071 "The model has two identical many-to-many relations "
10721072 f"through the intermediate model '{ f .remote_field .through ._meta .label } '." ,
10731073 obj = cls ,
1074- id = "models.E003 " ,
1074+ id = "models.duplicate_many_to_many_relations " ,
10751075 )
10761076 )
10771077 else :
@@ -1088,7 +1088,7 @@ def _check_id_field(cls):
10881088 PreflightResult (
10891089 "'id' is a reserved word that cannot be used as a field name." ,
10901090 obj = cls ,
1091- id = "models.E004 " ,
1091+ id = "models.reserved_field_name_id " ,
10921092 )
10931093 ]
10941094 return []
@@ -1114,7 +1114,7 @@ def _check_field_name_clashes(cls):
11141114 f"The field '{ f .name } ' clashes with the field '{ clash .name } ' "
11151115 f"from model '{ clash .model ._meta } '." ,
11161116 obj = f ,
1117- id = "models.E006 " ,
1117+ id = "models.field_name_clash " ,
11181118 )
11191119 )
11201120 used_fields [f .name ] = f
@@ -1139,7 +1139,7 @@ def _check_column_name_clashes(cls):
11391139 "another field." ,
11401140 hint = "Specify a 'db_column' for the field." ,
11411141 obj = cls ,
1142- id = "models.E007 " ,
1142+ id = "models.db_column_clash " ,
11431143 )
11441144 )
11451145 else :
@@ -1157,7 +1157,7 @@ def _check_model_name_db_lookup_clashes(cls):
11571157 f"The model name '{ model_name } ' cannot start or end with an underscore "
11581158 "as it collides with the query lookup syntax." ,
11591159 obj = cls ,
1160- id = "models.E023 " ,
1160+ id = "models.model_name_underscore_bounds " ,
11611161 )
11621162 )
11631163 elif LOOKUP_SEP in model_name :
@@ -1166,7 +1166,7 @@ def _check_model_name_db_lookup_clashes(cls):
11661166 f"The model name '{ model_name } ' cannot contain double underscores as "
11671167 "it collides with the query lookup syntax." ,
11681168 obj = cls ,
1169- id = "models.E024 " ,
1169+ id = "models.model_name_double_underscore " ,
11701170 )
11711171 )
11721172 return errors
@@ -1187,7 +1187,7 @@ def _check_property_name_related_field_accessor_clashes(cls):
11871187 f"The property '{ accessor } ' clashes with a related field "
11881188 "accessor." ,
11891189 obj = cls ,
1190- id = "models.E025 " ,
1190+ id = "models.property_related_field_clash " ,
11911191 )
11921192 )
11931193 return errors
@@ -1201,7 +1201,7 @@ def _check_single_primary_key(cls):
12011201 "The model cannot have more than one field with "
12021202 "'primary_key=True'." ,
12031203 obj = cls ,
1204- id = "models.E026 " ,
1204+ id = "models.multiple_primary_keys " ,
12051205 )
12061206 )
12071207 return errors
@@ -1220,7 +1220,7 @@ def _check_indexes(cls):
12201220 f"The index name '{ index .name } ' cannot start with an underscore "
12211221 "or a number." ,
12221222 obj = cls ,
1223- id = "models.E033 " ,
1223+ id = "models.index_name_invalid_start " ,
12241224 ),
12251225 )
12261226 if len (index .name ) > index .max_name_length :
@@ -1229,7 +1229,7 @@ def _check_indexes(cls):
12291229 "The index name '%s' cannot be longer than %d " # noqa: UP031
12301230 "characters." % (index .name , index .max_name_length ),
12311231 obj = cls ,
1232- id = "models.E034 " ,
1232+ id = "models.index_name_too_long " ,
12331233 ),
12341234 )
12351235 if index .contains_expressions :
@@ -1250,7 +1250,7 @@ def _check_indexes(cls):
12501250 ),
12511251 warning = True ,
12521252 obj = cls ,
1253- id = "models.W037 " ,
1253+ id = "models.index_conditions_ignored " ,
12541254 )
12551255 )
12561256 if not (
@@ -1266,7 +1266,7 @@ def _check_indexes(cls):
12661266 ),
12671267 warning = True ,
12681268 obj = cls ,
1269- id = "models.W040 " ,
1269+ id = "models.index_non_key_columns_ignored " ,
12701270 )
12711271 )
12721272 if not (
@@ -1282,7 +1282,7 @@ def _check_indexes(cls):
12821282 ),
12831283 warning = True ,
12841284 obj = cls ,
1285- id = "models.W043 " ,
1285+ id = "models.index_on_foreign_key " ,
12861286 )
12871287 )
12881288 fields = [
@@ -1314,7 +1314,7 @@ def _check_local_fields(cls, fields, option):
13141314 PreflightResult (
13151315 f"'{ option } ' refers to the nonexistent field '{ field_name } '." ,
13161316 obj = cls ,
1317- id = "models.E012 " ,
1317+ id = "models.nonexistent_field_reference " ,
13181318 )
13191319 )
13201320 else :
@@ -1324,7 +1324,7 @@ def _check_local_fields(cls, fields, option):
13241324 f"'{ option } ' refers to a ManyToManyField '{ field_name } ', but "
13251325 f"ManyToManyFields are not permitted in '{ option } '." ,
13261326 obj = cls ,
1327- id = "models.E013 " ,
1327+ id = "models.m2m_field_in_meta_option " ,
13281328 )
13291329 )
13301330 elif field not in cls ._meta .local_fields :
@@ -1334,7 +1334,7 @@ def _check_local_fields(cls, fields, option):
13341334 f"'{ cls ._meta .object_name } '." ,
13351335 hint = "This issue may be caused by multi-table inheritance." ,
13361336 obj = cls ,
1337- id = "models.E016 " ,
1337+ id = "models.non_local_field_reference " ,
13381338 )
13391339 )
13401340 return errors
@@ -1355,7 +1355,7 @@ def _check_ordering(cls):
13551355 "'ordering' must be a tuple or list (even if you want to order by "
13561356 "only one field)." ,
13571357 obj = cls ,
1358- id = "models.E014 " ,
1358+ id = "models.ordering_not_tuple_or_list " ,
13591359 )
13601360 ]
13611361
@@ -1398,7 +1398,7 @@ def _check_ordering(cls):
13981398 "'ordering' refers to the nonexistent field, "
13991399 f"related field, or lookup '{ field } '." ,
14001400 obj = cls ,
1401- id = "models.E015 " ,
1401+ id = "models.ordering_nonexistent_field " ,
14021402 )
14031403 )
14041404
@@ -1425,7 +1425,7 @@ def _check_ordering(cls):
14251425 "'ordering' refers to the nonexistent field, related "
14261426 f"field, or lookup '{ invalid_field } '." ,
14271427 obj = cls ,
1428- id = "models.E015 " ,
1428+ id = "models.ordering_nonexistent_field " ,
14291429 )
14301430 )
14311431 return errors
@@ -1462,7 +1462,7 @@ def _check_long_column_names(cls):
14621462 f'Maximum length is "{ allowed_len } " for the database.' ,
14631463 hint = "Set the column name manually using 'db_column'." ,
14641464 obj = cls ,
1465- id = "models.E018 " ,
1465+ id = "models.autogenerated_column_name_too_long " ,
14661466 )
14671467 )
14681468
@@ -1489,7 +1489,7 @@ def _check_long_column_names(cls):
14891489 "M2M and then set column_name using 'db_column'."
14901490 ),
14911491 obj = cls ,
1492- id = "models.E019 " ,
1492+ id = "models.m2m_column_name_too_long " ,
14931493 )
14941494 )
14951495
@@ -1529,7 +1529,7 @@ def _check_constraints(cls):
15291529 "warning if you don't care about it."
15301530 ),
15311531 obj = cls ,
1532- id = "models.W027 " ,
1532+ id = "models.constraint_on_non_db_field " ,
15331533 warning = True ,
15341534 )
15351535 )
@@ -1551,7 +1551,7 @@ def _check_constraints(cls):
15511551 "warning if you don't care about it."
15521552 ),
15531553 obj = cls ,
1554- id = "models.W036 " ,
1554+ id = "models.constraint_on_virtual_field " ,
15551555 warning = True ,
15561556 )
15571557 )
@@ -1573,7 +1573,7 @@ def _check_constraints(cls):
15731573 "warning if you don't care about it."
15741574 ),
15751575 obj = cls ,
1576- id = "models.W038 " ,
1576+ id = "models.constraint_on_foreign_key " ,
15771577 warning = True ,
15781578 )
15791579 )
@@ -1594,7 +1594,7 @@ def _check_constraints(cls):
15941594 "warning if you don't care about it."
15951595 ),
15961596 obj = cls ,
1597- id = "models.W039 " ,
1597+ id = "models.constraint_on_m2m_field " ,
15981598 warning = True ,
15991599 )
16001600 )
@@ -1615,7 +1615,7 @@ def _check_constraints(cls):
16151615 "warning if you don't care about it."
16161616 ),
16171617 obj = cls ,
1618- id = "models.W044 " ,
1618+ id = "models.constraint_on_self_referencing_fk " ,
16191619 warning = True ,
16201620 )
16211621 )
@@ -1662,7 +1662,7 @@ def _check_constraints(cls):
16621662 ),
16631663 warning = True ,
16641664 obj = cls ,
1665- id = "models.W045 " ,
1665+ id = "models.constraint_name_collision_autogenerated " ,
16661666 ),
16671667 )
16681668 for field_name , * lookups in references :
@@ -1688,7 +1688,7 @@ def _check_constraints(cls):
16881688 PreflightResult (
16891689 f"'constraints' refers to the joined field '{ LOOKUP_SEP .join ([field_name ] + lookups )} '." ,
16901690 obj = cls ,
1691- id = "models.E041 " ,
1691+ id = "models.constraint_refers_to_joined_field " ,
16921692 )
16931693 )
16941694 errors .extend (cls ._check_local_fields (fields , "constraints" ))
0 commit comments