summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnubhav Joshi <anubhav9042@gmail.com>2014-06-14 12:54:19 +0530
committerTim Graham <timograham@gmail.com>2014-07-01 06:12:58 -0400
commit34ba86706f0db33d9a0ab44e4abb78703e7262a9 (patch)
tree03eecf917508ff81d80ab262d4b3336973f082da /docs
parent81edf2d006f57d53ef08d0c881adf66f9aa391f7 (diff)
Fixed #14334 -- Query relation lookups now check object types.
Thanks rpbarlow for the suggestion; and loic, akaariai, and jorgecarleitao for reviews.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.8.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 7534a16e3d..793c781e2f 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -350,6 +350,21 @@ The check also applies to the columns generated in an implicit
and then specify :attr:`~django.db.models.Field.db_column` on its column(s)
as needed.
+Query relation lookups now check object types
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Querying for model lookups now checks if the object passed is of correct type
+and raises a :exc:`ValueError` if not. Previously, Django didn't care if the
+object was of correct type; it just used the object's related field attribute
+(e.g. ``id``) for the lookup. Now, an error is raised to prevent incorrect
+lookups::
+
+ >>> book = Book.objects.create(name="Django")
+ >>> book = Book.objects.filter(author=book)
+ Traceback (most recent call last):
+ ...
+ ValueError: Cannot query "<Book: Django>": Must be "Author" instance.
+
Miscellaneous
~~~~~~~~~~~~~