[1.8.x] Fixed typos of "select_related" in docs and tests.

Backport of 7d363ed432 from master
This commit is contained in:
Josh Schneier 2015-02-04 01:01:59 -05:00 committed by Tim Graham
parent fc49e73648
commit 16e3910e9c
3 changed files with 5 additions and 5 deletions

View File

@ -805,8 +805,8 @@ You can use ``select_related()`` with any queryset of objects::
The order of ``filter()`` and ``select_related()`` chaining isn't important. The order of ``filter()`` and ``select_related()`` chaining isn't important.
These querysets are equivalent:: These querysets are equivalent::
Entry.objects.filter(pub_date__gt=timezone.now()).selected_related('blog') Entry.objects.filter(pub_date__gt=timezone.now()).select_related('blog')
Entry.objects.selected_related('blog').filter(pub_date__gt=timezone.now()) Entry.objects.select_related('blog').filter(pub_date__gt=timezone.now())
You can follow foreign keys in a similar way to querying them. If you have the You can follow foreign keys in a similar way to querying them. If you have the
following models:: following models::

View File

@ -109,13 +109,13 @@ class DeferTests(AssertionMixin, TestCase):
self.assertEqual(obj.related_id, self.s1.pk) self.assertEqual(obj.related_id, self.s1.pk)
self.assertEqual(obj.name, "p1") self.assertEqual(obj.name, "p1")
def test_defer_selected_related_raises_invalid_query(self): def test_defer_select_related_raises_invalid_query(self):
# When we defer a field and also select_related it, the query is # When we defer a field and also select_related it, the query is
# invalid and raises an exception. # invalid and raises an exception.
with self.assertRaises(InvalidQuery): with self.assertRaises(InvalidQuery):
Primary.objects.defer("related").select_related("related")[0] Primary.objects.defer("related").select_related("related")[0]
def test_only_selected_related_raises_invalid_query(self): def test_only_select_related_raises_invalid_query(self):
with self.assertRaises(InvalidQuery): with self.assertRaises(InvalidQuery):
Primary.objects.only("name").select_related("related")[0] Primary.objects.only("name").select_related("related")[0]

View File

@ -219,7 +219,7 @@ class DeferRegressionTest(TestCase):
self.assertEqual(obj.item, item2) self.assertEqual(obj.item, item2)
self.assertEqual(obj.item_id, item2.id) self.assertEqual(obj.item_id, item2.id)
def test_proxy_model_defer_with_selected_related(self): def test_proxy_model_defer_with_select_related(self):
# Regression for #22050 # Regression for #22050
item = Item.objects.create(name="first", value=47) item = Item.objects.create(name="first", value=47)
RelatedItem.objects.create(item=item) RelatedItem.objects.create(item=item)