1
0
mirror of https://github.com/django/django.git synced 2025-10-28 08:06:09 +00:00

Improved warning message when reloading models. Refs #23621.

Thanks dfunckt and Tim Graham.
This commit is contained in:
Loic Bistuer
2014-10-23 01:28:57 +07:00
parent 8c4ca16c65
commit b62f72498a
2 changed files with 7 additions and 2 deletions

View File

@@ -211,7 +211,9 @@ class Apps(object):
if (model.__name__ == app_models[model_name].__name__ and
model.__module__ == app_models[model_name].__module__):
warnings.warn(
"Model '%s.%s' was already registered." % (model_name, app_label),
"Model '%s.%s' was already registered. "
"Reloading models is not advised as it can lead to inconsistencies, "
"most notably with related models." % (model_name, app_label),
RuntimeWarning, stacklevel=2)
else:
raise RuntimeError(