diff options
| author | Simon Charette <charettes@users.noreply.github.com> | 2016-11-30 12:08:26 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-11-30 12:08:26 -0500 |
| commit | ad8f6a45eb44dbf527f915246883034c8554754c (patch) | |
| tree | 2878d1f11c5d7ee096a20e6b9bc4c0661df5fe3e /docs | |
| parent | cc9e4297019bcec9fe0fee2199aa30fb1f6e90b7 (diff) | |
Replaced RawSQL with Cast in Coalesce doc example.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/database-functions.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt index ad653a710b..231d023e11 100644 --- a/docs/ref/models/database-functions.txt +++ b/docs/ref/models/database-functions.txt @@ -76,11 +76,11 @@ Usage examples:: A Python value passed to ``Coalesce`` on MySQL may be converted to an incorrect type unless explicitly cast to the correct database type: - >>> from django.db.models.expressions import RawSQL + >>> from django.db.models import DateTimeField + >>> from django.db.models.functions import Cast, Coalesce >>> from django.utils import timezone >>> now = timezone.now() - >>> now_sql = RawSQL("cast(%s as datetime)", (now,)) - >>> Coalesce('updated', now_sql) + >>> Coalesce('updated', Cast(now, DateTimeField())) ``Concat`` ========== |
