summaryrefslogtreecommitdiff
path: root/django/core/management.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-21 01:29:58 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-21 01:29:58 +0000
commit92c35a0617836b09aef3b6909579ee368004969b (patch)
treecd5a12f945bf105a53a0346f84c7d5ca6fc7f11f /django/core/management.py
parent03966f077b8f87d6a59366dedc80fcf1f935e2d3 (diff)
Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible change. Added a real FloatField (stores floats in the database) and support for FloatField and DecimalField in newforms (analogous to IntegerField). Included decimal.py module (as django.utils._decimal) from Python 2.4. This is license compatible with Django and included for Python 2.3 compatibility only. Large portions of this work are based on patches from Andy Durdin and Jorge Gajon. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/management.py')
-rw-r--r--django/core/management.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/core/management.py b/django/core/management.py
index 327796dc14..e72f05e314 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -870,7 +870,7 @@ def inspectdb():
if field_type == 'CharField' and row[3]:
extra_params['maxlength'] = row[3]
- if field_type == 'FloatField':
+ if field_type == 'DecimalField':
extra_params['max_digits'] = row[4]
extra_params['decimal_places'] = row[5]
@@ -945,11 +945,11 @@ def get_validation_errors(outfile, app=None):
e.add(opts, '"%s": You can\'t use "id" as a field name, because each model automatically gets an "id" field if none of the fields have primary_key=True. You need to either remove/rename your "id" field or add primary_key=True to a field.' % f.name)
if isinstance(f, models.CharField) and f.maxlength in (None, 0):
e.add(opts, '"%s": CharFields require a "maxlength" attribute.' % f.name)
- if isinstance(f, models.FloatField):
+ if isinstance(f, models.DecimalField):
if f.decimal_places is None:
- e.add(opts, '"%s": FloatFields require a "decimal_places" attribute.' % f.name)
+ e.add(opts, '"%s": DecimalFields require a "decimal_places" attribute.' % f.name)
if f.max_digits is None:
- e.add(opts, '"%s": FloatFields require a "max_digits" attribute.' % f.name)
+ e.add(opts, '"%s": DecimalFields require a "max_digits" attribute.' % f.name)
if isinstance(f, models.FileField) and not f.upload_to:
e.add(opts, '"%s": FileFields require an "upload_to" attribute.' % f.name)
if isinstance(f, models.ImageField):