1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #24776 -- Improved apps.get_app_config() error message on fully-qualified package names.

This commit is contained in:
Peter Inglesby
2015-05-12 10:02:23 +01:00
committed by Tim Graham
parent 70faaccc3e
commit 0688a7946a
4 changed files with 17 additions and 8 deletions

View File

@@ -147,7 +147,12 @@ class Apps(object):
try:
return self.app_configs[app_label]
except KeyError:
raise LookupError("No installed app with label '%s'." % app_label)
message = "No installed app with label '%s'." % app_label
for app_config in self.get_app_configs():
if app_config.name == app_label:
message += " Did you mean '%s'?" % app_config.label
break
raise LookupError(message)
# This method is performance-critical at least for Django's test suite.
@lru_cache.lru_cache(maxsize=None)