Code

Ticket #6961: patch1.txt

File patch1.txt, 865 bytes (added by pmd, 6 years ago)

patch to make loaddata use app dir and not models module dir

Line 
1Index: django/core/management/commands/loaddata.py
2===================================================================
3--- django/core/management/commands/loaddata.py (revision 7403)
4+++ django/core/management/commands/loaddata.py (working copy)
5@@ -47,7 +47,14 @@
6         transaction.enter_transaction_management()
7         transaction.managed(True)
8 
9-        app_fixtures = [os.path.join(os.path.dirname(app.__file__), 'fixtures') for app in get_apps()]
10+        app_fixtures = []
11+       for app in get_apps():
12+           app_path = app.__file__
13+           parts = os.path.split(app_path)
14+           if parts[1].startswith('__init__'):
15+               parts = os.path.split(parts[0]) # move up to app dir
16+           app_fixtures.append(os.path.join(parts[0], 'fixtures'))
17+
18         for fixture_label in fixture_labels:
19             parts = fixture_label.split('.')
20             if len(parts) == 1: