mirror of https://github.com/django/django.git
Improved model validator to check for upload_to attribute in FileFields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@622 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
65bab4b824
commit
e5a801590a
|
@ -520,6 +520,8 @@ def get_validation_errors(outfile):
|
||||||
for f in opts.fields:
|
for f in opts.fields:
|
||||||
if isinstance(f, meta.CharField) and f.maxlength in (None, 0):
|
if isinstance(f, meta.CharField) and f.maxlength in (None, 0):
|
||||||
e.add(opts, '"%s" field: CharFields require a "maxlength" attribute.' % f.name)
|
e.add(opts, '"%s" field: CharFields require a "maxlength" 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 f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
|
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.' % f.name)
|
e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' % f.name)
|
||||||
if f.choices:
|
if f.choices:
|
||||||
|
|
Loading…
Reference in New Issue