mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.10.x] Replaced RawSQL with Cast in Coalesce doc example.
Backport of ad8f6a45eb from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						parent
						
							81b5971b1c
						
					
				
				
					commit
					4074fa9145
				
			| @@ -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`` | ||||
| ========== | ||||
|   | ||||
		Reference in New Issue
	
	Block a user