summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Hinderyckx <mathieu@otainsight.com>2017-08-13 15:24:14 +0200
committerTim Graham <timograham@gmail.com>2017-08-14 14:57:34 -0400
commit1214e7c1b1248a7e51dfbdaaaed5bca56956f218 (patch)
tree2df2c50812eb97c7d7b055d422084906c10f732f
parentb0ed14644a10dc8263e02b7f075e31169b450ea7 (diff)
[1.11.x] Clarified Concat example in docs.
Backport of cf5740fbc8414ab722b938f92b4363ff00d8db88 from master
-rw-r--r--docs/ref/models/database-functions.txt12
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt
index a252069519..0b0b0050ff 100644
--- a/docs/ref/models/database-functions.txt
+++ b/docs/ref/models/database-functions.txt
@@ -90,8 +90,9 @@ Usage examples::
Accepts a list of at least two text fields or expressions and returns the
concatenated text. Each argument must be of a text or char type. If you want
to concatenate a ``TextField()`` with a ``CharField()``, then be sure to tell
-Django that the ``output_field`` should be a ``TextField()``. This is also
-required when concatenating a ``Value`` as in the example below.
+Django that the ``output_field`` should be a ``TextField()``. Specifying an
+``output_field`` is also required when concatenating a ``Value`` as in the
+example below.
This function will never have a null result. On backends where a null argument
results in the entire expression being null, Django will ensure that each null
@@ -104,8 +105,11 @@ Usage example::
>>> from django.db.models.functions import Concat
>>> Author.objects.create(name='Margaret Smith', goes_by='Maggie')
>>> author = Author.objects.annotate(
- ... screen_name=Concat('name', V(' ('), 'goes_by', V(')'),
- ... output_field=CharField())).get()
+ ... screen_name=Concat(
+ ... 'name', V(' ('), 'goes_by', V(')'),
+ ... output_field=CharField()
+ ... )
+ ... ).get()
>>> print(author.screen_name)
Margaret Smith (Maggie)