mirror of
https://github.com/django/django.git
synced 2025-08-16 00:30:47 +00:00
[1.9.x] Refs #26021 -- Used hanging indentation in some doc examples.
Backport of e475e84970
from master
This commit is contained in:
parent
936a7df652
commit
dbd72b850b
4 changed files with 30 additions and 20 deletions
|
@ -519,8 +519,7 @@ will return ``Blog`` objects that have an empty ``name`` on the ``author`` and
|
|||
also those which have an empty ``author`` on the ``entry``. If you don't want
|
||||
those latter objects, you could write::
|
||||
|
||||
Blog.objects.filter(entry__authors__isnull=False,
|
||||
entry__authors__name__isnull=True)
|
||||
Blog.objects.filter(entry__authors__isnull=False, entry__authors__name__isnull=True)
|
||||
|
||||
Spanning multi-valued relationships
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -556,14 +555,12 @@ select all blogs that contain entries with both *"Lennon"* in the headline
|
|||
and that were published in 2008 (the same entry satisfying both conditions),
|
||||
we would write::
|
||||
|
||||
Blog.objects.filter(entry__headline__contains='Lennon',
|
||||
entry__pub_date__year=2008)
|
||||
Blog.objects.filter(entry__headline__contains='Lennon', entry__pub_date__year=2008)
|
||||
|
||||
To select all blogs that contain an entry with *"Lennon"* in the headline
|
||||
**as well as** an entry that was published in 2008, we would write::
|
||||
|
||||
Blog.objects.filter(entry__headline__contains='Lennon').filter(
|
||||
entry__pub_date__year=2008)
|
||||
Blog.objects.filter(entry__headline__contains='Lennon').filter(entry__pub_date__year=2008)
|
||||
|
||||
Suppose there is only one blog that had both entries containing *"Lennon"* and
|
||||
entries from 2008, but that none of the entries from 2008 contained *"Lennon"*.
|
||||
|
|
|
@ -1693,9 +1693,11 @@ and contents::
|
|||
class EmailTest(TestCase):
|
||||
def test_send_email(self):
|
||||
# Send message.
|
||||
mail.send_mail('Subject here', 'Here is the message.',
|
||||
mail.send_mail(
|
||||
'Subject here', 'Here is the message.',
|
||||
'from@example.com', ['to@example.com'],
|
||||
fail_silently=False)
|
||||
fail_silently=False,
|
||||
)
|
||||
|
||||
# Test that one message has been sent.
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue