Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  django/core/management.py
5  django/core/management.py
@@ -1017,10 +1017,12 @@ def get_validation_errors(outfile, app=None):
1017 1017
 
1018 1018
     return len(e.errors)
1019 1019
 
1020  
-def validate(outfile=sys.stdout):
  1020
+def validate(outfile=sys.stdout, silent_success=False):
1021 1021
     "Validates all installed models."
1022 1022
     try:
1023 1023
         num_errors = get_validation_errors(outfile)
  1024
+        if silent_success and num_errors == 0:
  1025
+            return
1024 1026
         outfile.write('%s error%s found.\n' % (num_errors, num_errors != 1 and 's' or ''))
1025 1027
     except ImproperlyConfigured:
1026 1028
         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):
1337 1339
         action_mapping[action](args[1:])
1338 1340
     else:
1339 1341
         from django.db import models
  1342
+        validate(silent_success=True)
1340 1343
         try:
1341 1344
             mod_list = [models.get_app(app_label) for app_label in args[1:]]
1342 1345
         except ImportError, e:

0 notes on commit 6cdd341

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