1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Made it possible to create apps without a models module.

This commit reverts f44c4a5d0f and 39bbd165.

django.test.simple will be updated in a separate commit as it requires
invasive changes.
This commit is contained in:
Aymeric Augustin
2013-12-14 18:51:58 +01:00
parent 69039becde
commit 5ba743e262
14 changed files with 53 additions and 51 deletions

View File

@@ -345,12 +345,16 @@ class AppCommand(BaseCommand):
if not app_labels:
raise CommandError('Enter at least one appname.')
try:
app_list = [app_cache.get_app_config(app_label).models_module for app_label in app_labels]
app_configs = [app_cache.get_app_config(app_label) for app_label in app_labels]
except (LookupError, ImportError) as e:
raise CommandError("%s. Are you sure your INSTALLED_APPS setting is correct?" % e)
output = []
for app in app_list:
app_output = self.handle_app(app, **options)
for app_config in app_configs:
if app_config.models_module is None:
raise CommandError(
"AppCommand cannot handle app %r because it doesn't have "
"a models module." % app_config.label)
app_output = self.handle_app(app_config.models_module, **options)
if app_output:
output.append(app_output)
return '\n'.join(output)