diff options
| author | Niclas Olofsson <n@niclasolofsson.se> | 2014-12-04 21:47:48 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-24 14:54:30 -0500 |
| commit | 3daa9d60be6672841ceed5bb812b6fb25950dc16 (patch) | |
| tree | 1771ecd7ab15fd5795bb605c9d7e710ed0b86935 /docs | |
| parent | b27db97b236569d059fa824c3078e06adf8b4fae (diff) | |
Fixed #10414 -- Made select_related() fail on invalid field names.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.8.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 7f8005088a..f1960304c4 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -681,6 +681,24 @@ lookups:: ... ValueError: Cannot query "<Book: Django>": Must be "Author" instance. +``select_related()`` now checks given fields +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``select_related()`` now validates that the given fields actually exist. +Previously, nonexistent fields were silently ignored. Now, an error is raised:: + + >>> book = Book.objects.select_related('nonexistent_field') + Traceback (most recent call last): + ... + FieldError: Invalid field name(s) given in select_related: 'nonexistent_field' + +The validation also makes sure that the given field is relational:: + + >>> book = Book.objects.select_related('name') + Traceback (most recent call last): + ... + FieldError: Non-relational field given in select_related: 'name' + Default ``EmailField.max_length`` increased to 254 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
