My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 44: django-reversion and mptt don't play along if you recover
3 people starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Owner:  ----
Closed:  Jul 2009


 
Reported by lauber.p...@gmail.com, Feb 3, 2009
if you recover a model that has mptt with django-reversion you get an error
in signals.py line 110:

old_parent = getattr(instance._default_manager.get(pk=instance.pk),
                             opts.parent_attr)

the problem lies that you try to load the old version that doesn't exist in
the database but the model already has a PK.

maybe make try ... except here
Mar 10, 2009
#1 eyep...@gmail.com
I'm seeing the same error, without use of django-reversion.  The steps to recreate
are to mptt.register any model, and then attempt to .save() a new instance where you
specify the id value (or the pk, whatever it's named).  In signals.py it assumes this
means the instance exists, and attempts a .get() which fails, as this is a pre-save
signal.  A try/except may not work (on line 110), as we probably still want it to
behave as if it is a new instance and pass the test on line 92 (or amend the test
somehow).

My dirty solution would be a kwarg passed in the .save(), since forced PK's are
somewhat rare.
Jul 1, 2009
Project Member #2 jonathan.buchanan
Duplicate of  issue 17 
Status: Duplicate

Powered by Google Project Hosting