Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #484 -- Model validator now raises an error for FloatFields wit…

…hout max_digits or decimal_places

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 928318faf960acac81ee0ab788facd61cd4efd6a 1 parent 6f249c8
@adrianholovaty adrianholovaty authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 django/core/management.py
View
5 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):

0 comments on commit 928318f

Please sign in to comment.
Something went wrong with that request. Please try again.