| Issue 36: | Unable to get started | |
| 5 people starred this issue and may be notified of changes. | Back to list |
Hello,
I see on the Internet that other people have mptt working, but I am having
trouble getting off the ground. I have this model with a 'self' field.
class Characterizations(models.Model):
parent=models.ForeignKey(
'self',
null=True,
blank=True,
db_index=True,
help_text="Parent of node in tree")
dimen=models.ForeignKey(
Dimen,
related_name='characterizations_fk_dimen',
null=True,
blank=False,
db_index=True,
help_text="Dimension of characterization")
title=models.CharField(
max_length=72,
null=False,
blank=True,
db_index=False,
help_text="Title of this node (short)")
description=models.CharField(
max_length=72*24,
null=False,
blank=True,
db_index=False,
help_text="Description of this node (a paragraph)")
After installing mptt, at the top of models.py, right below "from django.db
import models" I added
import mptt
and I added 'mptt' to INSTALLED_APPS in settings.py.
Below the model I added
mptt.register(Characterizations, order_insertion_by='title')
and I try to run. I drop all tables (I have a command "psql -a -f
dropTables.sql az" for that). Then I run
/usr/local/bin/python manage.py reset --noinput pkgs
and I get the error (entire traceback at bottom):
File "/usr/local/lib/python2.5/site-packages/mptt/__init__.py", line 73, in
register
dispatcher.connect(pre_save, signal=model_signals.pre_save, sender=model)
AttributeError: 'module' object has no attribute 'connect'
Indeed, there is no connect() call at the top level in
django/dispatch/dispatcher.py . I see there a class Signal which itself
has a connect() call, but in mptt/__init__.py I don't see that Signal is
ever instantiated.
I just updated django out of svn a few minutes ago and it shows the same
behavior. I downloaded mptt version 0.2.1 this morning. I am running
Ubuntu (maybe Hardy Heron, but I have Python 2.5 which is why I call it out
of /usr/local/bin).
I'd be glad for any tips. (I'd also be glad to show any and all code if
that would help, of course.)
Thanks,
Jim Hefferon
...............................................................
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py",
line 340, in execute_manager
utility.execute()
File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py",
line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 221, in execute
self.validate()
File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 249, in validate
num_errors = get_validation_errors(s, app)
File
"/usr/local/lib/python2.5/site-packages/django/core/management/validation.py",
line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File
"/usr/local/lib/python2.5/site-packages/django/db/models/loading.py", line
128, in get_app_errors
self._populate()
File
"/usr/local/lib/python2.5/site-packages/django/db/models/loading.py", line
57, in _populate
self.load_app(app_name, True)
File
"/usr/local/lib/python2.5/site-packages/django/db/models/loading.py", line
72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/var/www/az/development/az/pkgs/models.py", line 710, in <module>
mptt.register(Characterizations, order_insertion_by='title')
File "/usr/local/lib/python2.5/site-packages/mptt/__init__.py", line 73,
in register
dispatcher.connect(pre_save, signal=model_signals.pre_save, sender=model)
Dec 5, 2008
#1
mocksoul
Dec 8, 2008
Thanks, but I run django from the svn and I have tried it with a number of recent versions.
Dec 20, 2008
I'm having the same issue here, running Django 1.0.1 final. The cause of this issue is the removal of some old deprecated methods in the dispatcher, see Django changeset #8291. http://code.djangoproject.com/changeset/8291
Jan 25, 2009
I had the same issue, but after banging my head against a wall for a few hours I came up with a solution that worked for me (on a linux box). My problem stemmed from the fact that i had used the installer BEFORE trying to install an up to date version from svn. First I deleted "/usr/local/lib/python2.5/site-packages/mptt/" to remove the older version of mptt. Then I used svn to get the latest release of mptt. Finally I opened a terminal in mptt-trunk and ran "sudo python setup.py install" to install the new version. Also, if you haven't done so, you might want to run "svn update" in your django_trunk folder. Good Luck -Caz
Feb 5, 2009
> Comment 5 by skopsycats, Jan 25, 2009 Thank you for this. It is exactly what I needed to hear. Just a note for anyone reading this who had the same problem: the docs on the web page similarly have to be updated. In particular, you need to say order_insertion_by=['title'] (making it a list). The docs from the svn are correct.
Jun 6, 2009
Thanks, you saved me a lot of time.
Aug 30, 2009
Yes - the current SVN release has it fixed. Thank you.
May 13, 2010
Fixed for me as well
Jun 17, 2010
Awesome, thanks!
Jun 18, 2010
Confirmed! works with mptt revision 121 and django 1.2.
Sep 2, 2010
The recently added 0.3 release and the source checkout from github work with Django 1.1+ The SVN repo is now out of date, if you are using it please upgrade to 0.3 or checkout the github source. (also the order_insertion_by bug is fixed in HEAD - it now accepts either string, tuple, or list)
Status:
Fixed
|