Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Improved model validator to check for upload_to attribute in FileFields

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e5a801590a062afaafa393bfc544c4441fea4362 1 parent 65bab4b
@adrianholovaty adrianholovaty authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/core/
2  django/core/
@@ -520,6 +520,8 @@ 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.' %
+ if isinstance(f, meta.FileField) and not f.upload_to:
+ e.add(opts, '"%s" field: FileFields require an "upload_to" attribute.' %
if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' %
if f.choices:

0 comments on commit e5a8015

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