Ticket #17115: patch.txt

File patch.txt, 829 bytes (added by shomodj@…, 12 years ago)

Patch

Line 
1diff -r e752cdf831a7 django/core/management/sql.py
2--- a/django/core/management/sql.py Wed Mar 23 05:06:31 2011 +0000
3+++ b/django/core/management/sql.py Fri Nov 18 15:04:20 2011 +0100
4@@ -147,7 +147,13 @@
5
6 def custom_sql_for_model(model, style, connection):
7 opts = model._meta
8- app_dir = os.path.normpath(os.path.join(os.path.dirname(models.get_app(model._meta.app_label).__file__), 'sql'))
9+ app_dir = os.path.dirname(models.get_app(model._meta.app_label).__file__)
10+
11+ # if models is a subpackage, we remove the models/ dir from the path
12+ if os.path.basename(app_dir) == 'models':
13+ (app_dir, models_dir) = os.path.split(app_dir)
14+
15+ app_dir = os.path.normpath(os.path.join(app_dir, 'sql'))
16 output = []
17
18 # Post-creation SQL should come before any initial SQL data is loaded.
Back to Top