summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2018-04-03 19:36:12 +0200
committerGitHub <noreply@github.com>2018-04-03 19:36:12 +0200
commit55cc26941a1eb6093bf9602e67a2b5fdf7e68683 (patch)
treea7e74536922b6bc467538966e795434dc03ad40a /docs/ref
parent6141c752fe7091d2197f5ac061300a9e0a36b09b (diff)
Refs #28643 -- Added Repeat database function.
Thanks Tim Graham and Nick Pope for reviews.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/database-functions.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt
index bbc7683ccf..d86853cc12 100644
--- a/docs/ref/models/database-functions.txt
+++ b/docs/ref/models/database-functions.txt
@@ -855,6 +855,25 @@ Usage example::
>>> print(author.name_code_point)
77
+``Repeat``
+----------
+
+.. class:: Repeat(expression, number, **extra)
+
+.. versionadded:: 2.1
+
+Returns the value of the given text field or expression repeated ``number``
+times.
+
+Usage example::
+
+ >>> from django.db.models.functions import Repeat
+ >>> Author.objects.create(name='John', alias='j')
+ >>> Author.objects.update(name=Repeat('name', 3))
+ 1
+ >>> print(Author.objects.get(alias='j').name)
+ JohnJohnJohn
+
``Replace``
-----------