summaryrefslogtreecommitdiff
path: root/django/core/management
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2009-12-19 15:27:50 +0000
committerLuke Plant <L.Plant.98@cantab.net>2009-12-19 15:27:50 +0000
commitc81f1da152817153dced7d9fe577c38d2ef01de6 (patch)
treebc254870e21bd21967dea07e762025f4e8a5bbd1 /django/core/management
parent281114d2095608c93a00df2fc55a72f7cd5c2fcf (diff)
[1.1.X] Fixed #6961 - loaddata fails if models is a package instead of a module
Thanks to pmd for report, zhaoz, mmalone and justinlilly for patch Backport of 11914 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/management')
-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('.')