Code

Ticket #1413: model-import-error.diff

File model-import-error.diff, 735 bytes (added by akaihola, 8 years ago)

strip '.models' from module path in the error message

Line 
1Index: magic-removal/django/db/models/base.py
2===================================================================
3--- magic-removal/django/db/models/base.py      (revision 2433)
4+++ magic-removal/django/db/models/base.py      (working copy)
5@@ -28,7 +28,7 @@
6 
7         # Raise ImportError if this model isn't in INSTALLED_APPS.
8         if re.sub('\.models$', '', mod) not in settings.INSTALLED_APPS:
9-            raise ImportError, "INSTALLED_APPS must contain %r in order for you to use this model." % mod
10+            raise ImportError, "INSTALLED_APPS must contain %r in order for you to use this model." % re.sub('\.models$', '', mod)
11 
12         # Create the class.
13         new_class = type.__new__(cls, name, bases, {'__module__': mod})