Skip to content

Commit

Permalink
Updated patch applied in r12504. Refs #12806.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12508 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Feb 23, 2010
1 parent 1d5165e commit 7ca3e8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/topics/db/sql.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ write::
>>> first_person = Person.objects.raw('SELECT * from myapp_person')[0]

However, the indexing and slicing are not performed at the database level. If
you have a big amount of ``Person`` objects in your database, it would be more
you have a big amount of ``Person`` objects in your database, it is more
efficient to limit the query at the SQL level::

>>> first_person = Person.objects.raw('SELECT * from myapp_person LIMIT 1')[0]
Expand Down
6 changes: 1 addition & 5 deletions tests/modeltests/raw_query/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,4 @@ def testGetItem(self):
first_two = Author.objects.raw(query)[0:2]
self.assertEquals(len(first_two), 2)

try:
Author.objects.raw(query)['test']
self.fail('Index lookups should only accept int, long or slice')
except TypeError:
pass
self.assertRaises(TypeError, lambda: Author.objects.raw(query)['test'])

0 comments on commit 7ca3e8f

Please sign in to comment.