From dbffffa7dc95fc62cbecfd00284bde62ee796f48 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 28 Jun 2011 10:16:18 +0000 Subject: Fixed #5535 -- Allow using an explicit foreign key in get() calls. Thanks, Michal Petrucha. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16473 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/db/queries.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs') diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index 3457913011..a4267489b9 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -365,6 +365,16 @@ translates (roughly) into the following SQL:: .. _`Keyword Arguments`: http://docs.python.org/tutorial/controlflow.html#keyword-arguments +.. versionchanged:: 1.4 + + The field specified in a lookup has to be the name of a model field. + There's one exception though, in case of a + :class:`~django.db.models.fields.ForeignKey` you can specify the field + name suffixed with ``_id``. In this case, the value parameter is expected + to contain the raw value of the foreign model's primary key. For example:: + + >>> Entry.objects.filter(blog_id__exact=4) + If you pass an invalid keyword argument, a lookup function will raise ``TypeError``. -- cgit v1.3