Browse Source

Replaced RawSQL with Cast in Coalesce doc example.

Simon Charette 8 years ago
parent
commit
ad8f6a45eb
1 changed files with 3 additions and 3 deletions
  1. 3 3
      docs/ref/models/database-functions.txt

+ 3 - 3
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``
 ==========