Using Python 2.6, Django 1.1, Treebeard 1.52, MySQL 5.1.42-community, winXP.
Not sure if this is a django problem or treebeard.
Loading the following code get IndexError:
try:
from django.db import models, transaction
from django.db.models import AutoField
import django.dispatch
from treebeard.mp_tree import MP_Node
except ImportError, exc:
print "django error in %s: %s" % (__file__, exc)
class DelibNode(MP_Node): pass
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Program Files\Python26\lib\site-packages\django
\db\models\base.py", line 52, in __new__
kwargs = {"app_label":
model_module.__name__.split('.')[-2]}
IndexError: list index out of range
Installed apps in setting.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.treebeard',
'medCE.delib' )
Workaround:
Changed code in django/db/models/base.py:
## if getattr(meta, 'app_label', None) is None:
## model_module = sys.modules[new_class.__module__]
## try:
## one_up = model_module.__name__.split('.')[-2]
## except IndexError:
## one_up = "treebeard"
## kwargs = {"app_label": one_up}
## else:
## kwargs = {}