|
@@ -121,13 +121,18 @@ class DjangoWorkerFixup(object):
|
|
|
|
|
|
def validate_models(self):
|
|
|
self.django_setup()
|
|
|
- from django.core.management.validation import get_validation_errors
|
|
|
- s = StringIO()
|
|
|
- num_errors = get_validation_errors(s, None)
|
|
|
- if num_errors:
|
|
|
- raise RuntimeError(
|
|
|
- 'One or more Django models did not validate:\n{0}'.format(
|
|
|
- s.getvalue()))
|
|
|
+ try:
|
|
|
+ from django.core.checks import run_checks
|
|
|
+ except ImportError: # django < 1.7
|
|
|
+ from django.core.management.validation import get_validation_errors
|
|
|
+ s = StringIO()
|
|
|
+ num_errors = get_validation_errors(s, None)
|
|
|
+ if num_errors:
|
|
|
+ raise RuntimeError(
|
|
|
+ 'One or more Django models did not validate:\n{0}'.format(
|
|
|
+ s.getvalue()))
|
|
|
+ else:
|
|
|
+ run_checks()
|
|
|
|
|
|
def install(self):
|
|
|
signals.beat_embedded_init.connect(self.close_database)
|