- Timestamp:
- 07/29/08 19:18:49 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/regressiontests/model_fields/models.py
r8104 r8143 2 2 from django.db import models 3 3 4 try: 5 import decimal 6 except ImportError: 7 from django.utils import _decimal as decimal # Python 2.3 fallback 8 4 9 class Foo(models.Model): 5 10 a = models.CharField(max_length=10) 11 d = models.DecimalField(max_digits=5, decimal_places=3) 6 12 7 13 def get_foo(): … … 23 29 (4,'Fourth'), 24 30 ) 25 ), 31 ), 26 32 (0,'Other'), 27 33 ) 28 34 c = models.IntegerField(choices=CHOICES, null=True) 29 35 30 36 __test__ = {'API_TESTS':""" 31 37 # Create a couple of Places. 32 >>> f = Foo.objects.create(a='abc' )38 >>> f = Foo.objects.create(a='abc', d=decimal.Decimal("12.34")) 33 39 >>> f.id 34 40 1 … … 68 74 u'' 69 75 76 # Regression test for #8023: should be able to filter decimal fields using 77 # strings (which is what gets passed through from, e.g., the admin interface). 78 >>> Foo.objects.filter(d=u'1.23') 79 [] 80 70 81 71 82 """}
