diff options
| author | Prashant Pandey <prashantpandey94551@gmail.com> | 2023-11-23 10:29:52 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-11-23 21:17:44 +0100 |
| commit | a8adb6aa6cc6b9efd043acc980b5744bc211c760 (patch) | |
| tree | f9c284c705b95baba0c2dc450bb18798377a70dc /tests/migrations | |
| parent | a89c715c3bcf7ab1a90747cf8658ebce6304b6e4 (diff) | |
Fixed #26827 -- Improved ModelState error message when relations refer model classes.
Diffstat (limited to 'tests/migrations')
| -rw-r--r-- | tests/migrations/test_state.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index f1ac78c992..686eba4500 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -1651,8 +1651,8 @@ class ModelStateTests(SimpleTestCase): field = models.ForeignKey(UnicodeModel, models.CASCADE) with self.assertRaisesMessage( ValueError, - 'ModelState.fields cannot refer to a model class - "field.to" does. ' - "Use a string reference instead.", + 'Model fields in "ModelState.fields" cannot refer to a model class - ' + '"app.Model.field.to" does. Use a string reference instead.', ): ModelState("app", "Model", [("field", field)]) @@ -1661,8 +1661,8 @@ class ModelStateTests(SimpleTestCase): field.remote_field.through = UnicodeModel with self.assertRaisesMessage( ValueError, - 'ModelState.fields cannot refer to a model class - "field.through" does. ' - "Use a string reference instead.", + 'Model fields in "ModelState.fields" cannot refer to a model class - ' + '"app.Model.field.through" does. Use a string reference instead.', ): ModelState("app", "Model", [("field", field)]) |
