diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-04-03 19:36:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-03 19:36:12 +0200 |
commit | 55cc26941a1eb6093bf9602e67a2b5fdf7e68683 (patch) | |
tree | a7e74536922b6bc467538966e795434dc03ad40a /docs | |
parent | 6141c752fe7091d2197f5ac061300a9e0a36b09b (diff) | |
download | django-55cc26941a1eb6093bf9602e67a2b5fdf7e68683.tar.gz |
Refs #28643 -- Added Repeat database function.
Thanks Tim Graham and Nick Pope for reviews.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/ref/models/database-functions.txt | 19 | ||||
-rw-r--r-- | docs/releases/2.1.txt | 1 |
2 files changed, 20 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`` ----------- diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt index 2b1d6dabdc..46a903ba11 100644 --- a/docs/releases/2.1.txt +++ b/docs/releases/2.1.txt @@ -210,6 +210,7 @@ Models :class:`~django.db.models.functions.LPad`, :class:`~django.db.models.functions.LTrim`, :class:`~django.db.models.functions.Ord`, + :class:`~django.db.models.functions.Repeat`, :class:`~django.db.models.functions.Replace`, :class:`~django.db.models.functions.Right`, :class:`~django.db.models.functions.RPad`, |