Skip to content

Commit e659dcc

Browse files
peterlauripelme
authored andcommitted
in django >= 1.9 one can set module value to None in settings.MIGRATION_MODULES to not run (#426)
1 parent bc23f20 commit e659dcc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pytest_django/migrations.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# code snippet copied from https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09
2+
from pytest_django.lazy_django import get_django_version
3+
4+
25
class DisableMigrations(object):
36

7+
def __init__(self):
8+
self._django_version = get_django_version()
9+
410
def __contains__(self, item):
511
return True
612

713
def __getitem__(self, item):
8-
return "notmigrations"
14+
if self._django_version >= (1, 9):
15+
return None
16+
else:
17+
return 'notmigrations'

0 commit comments

Comments
 (0)