Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed 'django-admin startapp' so that it try to write to INSTALLED_…

…APPS magically. Also changed 'django-admin sqlclear' to reverse the output

git-svn-id: http://code.djangoproject.com/svn/django/trunk@87 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0a35fce98ac118bcc8269e0cc330956399f38bd2 1 parent 8c61d24
Adrian Holovaty adrianholovaty authored
Showing with 1 addition and 12 deletions.
  1. +1 −12 django/bin/django-admin.py
13 django/bin/django-admin.py
View
@@ -127,7 +127,7 @@ def get_sql_delete(mod):
else:
output.append("DROP TABLE %s_%s;" % (opts.db_table, f.name))
output.append("DELETE FROM packages WHERE label = '%s';" % mod._MODELS[0]._meta.app_label)
- return output
+ return output[::-1] # Reverse it, to deal with table dependencies.
get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given app(s)."
get_sql_delete.args = APP_ARGS
@@ -339,17 +339,6 @@ def startapp(app_name, directory):
project_dir = os.path.normpath(os.path.join(directory, '../'))
project_name = os.path.basename(project_dir)
_start_helper('app', app_name, directory, project_name)
- settings_file = os.path.join(project_dir, 'settings/main.py')
- if os.path.exists(settings_file):
- try:
- settings_contents = open(settings_file, 'r').read()
- fp = open(settings_file, 'w')
- except IOError:
- pass
- else:
- settings_contents = re.sub(r'(?s)\b(INSTALLED_APPS\s*=\s*\()(.*?)\)', "\\1\n '%s',\\2)" % app_name, settings_contents)
- fp.write(settings_contents)
- fp.close()
startapp.help_doc = "Creates a Django app directory structure for the given app name in the current directory."
startapp.args = "[appname]"
Please sign in to comment.
Something went wrong with that request. Please try again.