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:43 -0500 |
commit | 4074fa91452006890a878f0b6a1a25251461cf26 (patch) | |
tree | 0f7e42d7ecbc1b7d6a89a2e65fa3791721bdc2a7 | |
parent | 81b5971b1ce044448466791b3c6f795b66c666d7 (diff) | |
download | django-4074fa91452006890a878f0b6a1a25251461cf26.tar.gz |
[1.10.x] Replaced RawSQL with Cast in Coalesce doc example.
Backport of ad8f6a45eb44dbf527f915246883034c8554754c from master
-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 927153af40..1bdfe42b6b 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`` ========== |