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:
parent
61caa88613
commit
9d809f2c3b
|
@ -35,8 +35,7 @@ class ModelBase(type):
|
||||||
|
|
||||||
model_module = sys.modules[new_class.__module__]
|
model_module = sys.modules[new_class.__module__]
|
||||||
|
|
||||||
if not hasattr(new_class._meta, 'app_label') or \
|
if getattr(new_class._meta, 'app_label', None) is None:
|
||||||
new_class._meta.app_label is None:
|
|
||||||
# Figure out the app_label by looking one level up.
|
# Figure out the app_label by looking one level up.
|
||||||
# For 'django.contrib.sites.models', this would be 'sites'.
|
# For 'django.contrib.sites.models', this would be 'sites'.
|
||||||
new_class._meta.app_label = model_module.__name__.split('.')[-2]
|
new_class._meta.app_label = model_module.__name__.split('.')[-2]
|
||||||
|
|
Loading…
Reference in New Issue