Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2425 -- Call validate() as part of generating SQL in order to …

…catch a

few more errors. Thanks, Simon Greenhill.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6cdd341dab3e634f5b969547a0d55d04a430e044 1 parent e8b572b
Malcolm Tredinnick malcolmt authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/core/management.py
5 django/core/management.py
View
@@ -1017,10 +1017,12 @@ def get_validation_errors(outfile, app=None):
return len(e.errors)
-def validate(outfile=sys.stdout):
+def validate(outfile=sys.stdout, silent_success=False):
"Validates all installed models."
try:
num_errors = get_validation_errors(outfile)
+ if silent_success and num_errors == 0:
+ return
outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
except ImproperlyConfigured:
outfile.write("Skipping validation because things aren't configured properly.")
@@ -1337,6 +1339,7 @@ def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING, argv=None):
action_mapping[action](args[1:])
else:
from django.db import models
+ validate(silent_success=True)
try:
mod_list = [models.get_app(app_label) for app_label in args[1:]]
except ImportError, e:
Please sign in to comment.
Something went wrong with that request. Please try again.