summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/loaddata.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index e70f85b9a6..817ffaa83e 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -76,7 +76,17 @@ class Command(BaseCommand):
if has_bz2:
compression_types['bz2'] = bz2.BZ2File
- app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
+ app_module_paths = []
+ for app in get_apps():
+ if hasattr(app, '__path__'):
+ # It's a 'models/' subpackage
+ for path in app.__path__:
+ app_module_paths.append(path)
+ else:
+ # It's a models.py module
+ app_module_paths.append(app.__file__)
+
+ app_fixtures = [os.path.join(os.path.dirname(path), 'fixtures') for path in app_module_paths]
for fixture_label in fixture_labels:
parts = fixture_label.split('.')