Skip to content

Commit 66a2cfc

Browse files
committed
Merge pull request #99 from nealtodd/master
Django >= 1.7 compatibility for requires_system_checks
2 parents 9ab4b78 + ae936de commit 66a2cfc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

devserver/management/commands/runserver.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ class Command(BaseCommand):
6767
args = '[optional port number, or ipaddr:port]'
6868

6969
# Validation is called explicitly each time the server is reloaded.
70-
requires_model_validation = False
70+
def __init__(self):
71+
# `requires_model_validation` is deprecated in favor of
72+
# `requires_system_checks`. If both options are present, an error is
73+
# raised. BaseCommand sets requires_system_checks in >= Django 1.7.
74+
if hasattr(self, 'requires_system_checks'):
75+
requires_system_checks = False
76+
else:
77+
requires_model_validation = False # Django < 1.7
78+
super(Command, self).__init__()
7179

7280
def run_from_argv(self, argv):
7381
parser = self.create_parser(argv[0], argv[1])

0 commit comments

Comments
 (0)