[1.8.x] Refs #23621 -- Fixed warning message when reloading models.
Backport of aabb58428beae0bd34f32e5d620a82486b670499 from master
This commit is contained in:
parent
fdaf9359ab
commit
42aa919de9
@ -213,7 +213,7 @@ class Apps(object):
|
|||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Model '%s.%s' was already registered. "
|
"Model '%s.%s' was already registered. "
|
||||||
"Reloading models is not advised as it can lead to inconsistencies, "
|
"Reloading models is not advised as it can lead to inconsistencies, "
|
||||||
"most notably with related models." % (model_name, app_label),
|
"most notably with related models." % (app_label, model_name),
|
||||||
RuntimeWarning, stacklevel=2)
|
RuntimeWarning, stacklevel=2)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
@ -234,7 +234,7 @@ class AppsTests(TestCase):
|
|||||||
self.assertEqual(len(w), 1)
|
self.assertEqual(len(w), 1)
|
||||||
self.assertTrue(issubclass(w[-1].category, RuntimeWarning))
|
self.assertTrue(issubclass(w[-1].category, RuntimeWarning))
|
||||||
self.assertEqual(str(w[-1].message),
|
self.assertEqual(str(w[-1].message),
|
||||||
"Model 'southponies.apps' was already registered. "
|
"Model 'apps.southponies' was already registered. "
|
||||||
"Reloading models is not advised as it can lead to inconsistencies, "
|
"Reloading models is not advised as it can lead to inconsistencies, "
|
||||||
"most notably with related models.")
|
"most notably with related models.")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user