Skip to content
Browse files

Fixed #4144 -- Only check sys.modules when required during Model class

construction. Patch from Marty Alchin.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent abff821 commit 93e2f246fdb3ac1b1c1b0e4c4f18961343199047 @malcolmt malcolmt committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 django/db/models/
2 django/db/models/
@@ -42,11 +42,11 @@ def __new__(cls, name, bases, attrs):
- 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.

0 comments on commit 93e2f24

Please sign in to comment.
Something went wrong with that request. Please try again.