mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Changed raise to conform to PEP 3109 and wrapped the long line. Added beginnings of tests for model fields. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
		
			
				
	
	
		
			19 lines
		
	
	
		
			286 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			286 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """
 | |
| >>> from django.db.models.fields import *
 | |
| 
 | |
| # DecimalField
 | |
| 
 | |
| >>> f = DecimalField()
 | |
| 
 | |
| >>> f.to_python(3)
 | |
| Decimal("3")
 | |
| 
 | |
| >>> f.to_python("3.14")
 | |
| Decimal("3.14")
 | |
| 
 | |
| >>> f.to_python("abc")
 | |
| Traceback (most recent call last):
 | |
| ...
 | |
| ValidationError: [u'This value must be a decimal number.']
 | |
| """
 |