mirror of https://github.com/django/django.git
Fixed typos of "select_related" in docs and tests.
This commit is contained in:
parent
79f27f2b61
commit
7d363ed432
|
@ -787,8 +787,8 @@ You can use ``select_related()`` with any queryset of objects::
|
|||
The order of ``filter()`` and ``select_related()`` chaining isn't important.
|
||||
These querysets are equivalent::
|
||||
|
||||
Entry.objects.filter(pub_date__gt=timezone.now()).selected_related('blog')
|
||||
Entry.objects.selected_related('blog').filter(pub_date__gt=timezone.now())
|
||||
Entry.objects.filter(pub_date__gt=timezone.now()).select_related('blog')
|
||||
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
|
||||
following models::
|
||||
|
|
|
@ -109,13 +109,13 @@ class DeferTests(AssertionMixin, TestCase):
|
|||
self.assertEqual(obj.related_id, self.s1.pk)
|
||||
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
|
||||
# invalid and raises an exception.
|
||||
with self.assertRaises(InvalidQuery):
|
||||
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):
|
||||
Primary.objects.only("name").select_related("related")[0]
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ class DeferRegressionTest(TestCase):
|
|||
self.assertEqual(obj.item, item2)
|
||||
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
|
||||
item = Item.objects.create(name="first", value=47)
|
||||
RelatedItem.objects.create(item=item)
|
||||
|
|
Loading…
Reference in New Issue