﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5066	"Calling ""manage.py reset <app>"" on an app that has no models causes crash"	gav@…	George Vilches	"{{{python manage.py --noinput reset <app>}}}, where the specified app does not have any classes that extend models.Model, results in this error:

{{{
Traceback (most recent call last):
  File ""manage.py"", line 12, in <module>
    execute_manager(settings)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management.py"", line 1744, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management.py"", line 1701, in execute_from_command_line
    output = action_mapping[action](mod, options.interactive)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management.py"", line 699, in reset
    sql_list = get_sql_reset(app)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management.py"", line 384, in get_sql_reset
    return get_sql_delete(app) + get_sql_all(app)
  File ""/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management.py"", line 370, in get_sql_delete
    app_label = app_models[0]._meta.app_label
IndexError: list index out of range
}}}

app_label on line 370 in django/core/management.py doesn't seem to be used anywhere, it's at the end of the method.  Removing that line prevents the crash and appears not to have any side effects.

Even though it doesn't necessarily make sense to call reset on an app with no models, it is a hindrance to have this crash occur if you are, for instance, writing scripts to reset all your apps (since a reset_all isn't provided in django.core.management), or doing anything else where you might reset multiple apps at once without knowing their contents.
"		closed	Core (Other)	dev		fixed	manage.py reset		Accepted	1	0	0	0	0	0
