summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-08 02:56:18 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-08 02:56:18 +0000
commit93e2f246fdb3ac1b1c1b0e4c4f18961343199047 (patch)
treecf15b168fe8044ab47492aa860e10000b7e3b4bb
parentabff821f142c4bca2f5a33f990384ba1a415af6c (diff)
Fixed #4144 -- Only check sys.modules when required during Model class
construction. Patch from Marty Alchin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/base.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index c6233f36dc..e02d6de861 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -42,11 +42,11 @@ class ModelBase(type):
new_class._meta.parents.append(base)
new_class._meta.parents.extend(base._meta.parents)
- model_module = sys.modules[new_class.__module__]
if getattr(new_class._meta, 'app_label', None) is None:
# Figure out the app_label by looking one level up.
# For 'django.contrib.sites.models', this would be 'sites'.
+ model_module = sys.modules[new_class.__module__]
new_class._meta.app_label = model_module.__name__.split('.')[-2]
# Bail out early if we have already created this class.