diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-11-20 22:28:57 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-11-20 22:28:57 +0000 |
| commit | 928318faf960acac81ee0ab788facd61cd4efd6a (patch) | |
| tree | 2185948f78efab0d48d51add3ddaffa79ce47700 | |
| parent | 6f249c856b0723b5b7f30b36f50889e19d12c825 (diff) | |
Fixed #484 -- Model validator now raises an error for FloatFields without max_digits or decimal_places
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/management.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/core/management.py b/django/core/management.py index 405371ebce..6b4f87b000 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -604,6 +604,11 @@ def get_validation_errors(outfile): for f in opts.fields: if isinstance(f, meta.CharField) and f.maxlength in (None, 0): e.add(opts, '"%s" field: CharFields require a "maxlength" attribute.' % f.name) + if isinstance(f, meta.FloatField): + if f.decimal_places is None: + e.add(opts, '"%s" field: FloatFields require a "decimal_places" attribute.' % f.name) + if f.max_digits is None: + e.add(opts, '"%s" field: FloatFields require a "max_digits" attribute.' % f.name) if isinstance(f, meta.FileField) and not f.upload_to: e.add(opts, '"%s" field: FileFields require an "upload_to" attribute.' % f.name) if isinstance(f, meta.ImageField): |
