I'm getting a non-descriptive (or at least I don't know how to interpret in this context) error message when sub-lassing from a Django-Treebeard node and am not sure how to debug. I'm using the installation instructions at: http://code.tabo.pe/django-treebeard/src/tip/tbexample/ (see at end of posting).
I create a subclass of MP_Node and the syncdb works. However, loading the models.py code into a shell produces a "list index out of range" error - see code and trace below.
Thanks for your help.
Python 2.6.4, Django 1.1, Treebeard 1.1:
try:
from django.db import models, transaction
from django.db.models import AutoField
import django.dispatch
from django.contrib.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 Settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.s ites',
'django.contrib.admin',
'django.contrib.treebeard',
'medCE.delib'
)
Instructions:
1. Run easy_install django-treebeard
to install the
latest treebeard version from PyPi
1.1. If you don't like easy_install, download a release from the
treebeard download page or get a development version
from the treebeard mercurial repository and run
python setup.py install
2. Add 'treebeard' to the INSTALLED_APPS
section in your
django settings file.
3. Create a new model that inherits from one of django-treebeard's
abstract tree models: mp_tree.MP_Node (materialized path),
ns_tree.NS_Node (nested sets) or al_tree.AL_Node
(adjacency list).
4. Run python manage.py syncdb