django/db/migrations/loader.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
index b700616..16ffbf2 100644
|
a
|
b
|
from __future__ import unicode_literals
|
| 2 | 2 | |
| 3 | 3 | from importlib import import_module |
| 4 | 4 | import os |
| | 5 | import pkgutil |
| 5 | 6 | import sys |
| 6 | 7 | |
| 7 | 8 | from django.apps import apps |
| … |
… |
class MigrationLoader(object):
|
| 89 | 90 | if was_loaded: |
| 90 | 91 | six.moves.reload_module(module) |
| 91 | 92 | self.migrated_apps.add(app_config.label) |
| 92 | | directory = os.path.dirname(module.__file__) |
| 93 | | # Scan for .py files |
| 94 | | migration_names = set() |
| 95 | | for name in os.listdir(directory): |
| 96 | | if name.endswith(".py"): |
| 97 | | import_name = name.rsplit(".", 1)[0] |
| 98 | | if import_name[0] not in "_.~": |
| 99 | | migration_names.add(import_name) |
| | 93 | # Scan for migrations |
| | 94 | migration_names = set([ |
| | 95 | name |
| | 96 | for _, name, is_pkg in pkgutil.iter_modules(module.__path__) |
| | 97 | if not is_pkg |
| | 98 | ]) |
| 100 | 99 | # Load them |
| 101 | 100 | south_style_migrations = False |
| 102 | 101 | for migration_name in migration_names: |