magic-removal: Small logic simplification in django.db.models.ModelBase

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2293 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-08 23:57:07 +00:00
parent 61caa88613
commit 9d809f2c3b
1 changed files with 1 additions and 2 deletions

View File

@ -35,8 +35,7 @@ class ModelBase(type):
model_module = sys.modules[new_class.__module__]
if not hasattr(new_class._meta, 'app_label') or \
new_class._meta.app_label is None:
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'.
new_class._meta.app_label = model_module.__name__.split('.')[-2]