Index: django/db/models/base.py
===================================================================
--- django/db/models/base.py	(Revision 4021)
+++ django/db/models/base.py	(Arbeitskopie)
@@ -39,9 +39,15 @@
         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.
+            # Figure out the app_label by looking one level up above 'models'.
             # For 'django.contrib.sites.models', this would be 'sites'.
-            new_class._meta.app_label = model_module.__name__.split('.')[-2]
+            modparts = model_module.__name__.split('.')
+            # search the first 'models' module name, which
+            # a) must exist and b) must have a leading module part
+            assert 'models' in modparts
+            idx = modparts.index('models')
+            assert idx > 0
+            new_class._meta.app_label = modparts[idx-1]
 
         # Bail out early if we have already created this class.
         m = get_model(new_class._meta.app_label, name, False)
