From 544a63779c19b8ae1156c993e5875108010ec573 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Fri, 23 Oct 2015 11:13:03 +0100 Subject: [PATCH] Fixed Django 1.7+ deprecation warning for requires_model_validation See https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#django.core.management.BaseCommand.requires_system_checks Also removed a rather low value test which wasn't worth rewriting. --- compressor/management/commands/compress.py | 8 ++++++-- compressor/tests/test_offline.py | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compressor/management/commands/compress.py b/compressor/management/commands/compress.py index 629d9cd..7b706fa 100644 --- a/compressor/management/commands/compress.py +++ b/compressor/management/commands/compress.py @@ -60,8 +60,6 @@ class Command(NoArgsCommand): dest="engine"), ) - requires_model_validation = False - def get_loaders(self): if django.VERSION < (1, 8): from django.template.loader import template_source_loaders @@ -302,3 +300,9 @@ class Command(NoArgsCommand): "Offline compression is disabled. Set " "COMPRESS_OFFLINE or use the --force to override.") self.compress(sys.stdout, **options) + + +if django.VERSION < (1, 7): + Command.requires_model_validation = False +else: + Command.requires_system_checks = False diff --git a/compressor/tests/test_offline.py b/compressor/tests/test_offline.py index aa10cf0..3a7f1b2 100644 --- a/compressor/tests/test_offline.py +++ b/compressor/tests/test_offline.py @@ -201,9 +201,6 @@ class OfflineCompressBasicTestCase(OfflineTestCaseMixin, TestCase): for engine in self.engines: self._test_deleting_manifest_does_not_affect_rendering(engine) - def test_requires_model_validation(self): - self.assertFalse(CompressCommand.requires_model_validation) - def test_get_loaders(self): TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', (