diff options
| author | Shubham Singh <ssingh@multimediallc.com> | 2025-09-11 14:47:05 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-09-22 08:35:53 -0400 |
| commit | dce1b9c2de00a3385c029c02dca325f44e7697a4 (patch) | |
| tree | 799283306c0bee93384fd81c18db64ec19207eb9 /tests | |
| parent | af84cfba5970fda8306860b650937701c7c03c6f (diff) | |
Fixed #36480 -- Made values() resolving error mention unselected aliases.
Follow-up to cb13792938f2c887134eb6b5164d89f8d8f9f1bd. Refs #34437.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/annotations/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index 8091498908..cf1eebf8d7 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -1539,3 +1539,13 @@ class AliasTests(TestCase): ) with self.assertRaisesMessage(ValueError, msg): Book.objects.alias(**{crafted_alias: FilteredRelation("authors")}) + + def test_values_wrong_alias(self): + expected_message = ( + "Cannot resolve keyword 'alias_typo' into field. Choices are: %s" + ) + alias_fields = ", ".join( + sorted(["my_alias"] + list(get_field_names_from_opts(Book._meta))) + ) + with self.assertRaisesMessage(FieldError, expected_message % alias_fields): + Book.objects.alias(my_alias=F("pk")).order_by("alias_typo") |
