Issue 19: using mptt with fixtures
Status:  Invalid
Owner: ----
Closed:  Oct 2008
Reported by BeatDr...@gmail.com, Apr 9, 2008
What steps will reproduce the problem?
1.create a model to register with django mptt 
2.register the model and sync the db 
3.try to use python manage.py loaddata fixture_file to load the fixture for
the concerned model

What is the expected output? What do you see instead?
The expected output was to load the fixtures. Instead, I get the message,
"problem installing fixutre 'myfixture': mytable.lft may not be NULL"

What version of the product are you using? On what operating system?


Please provide any additional information below.

HI,

I am using django mptt and I also want to use fixtures with my
registered model. However, since mptt inserts fields that are NOT
NULL, I was not able to do so.
I found this link
https://code.google.com/p/django-mptt/source/browse/trunk/docs/models.txt?r=100
where it was described that I have to patch django as in this ticket
http://code.djangoproject.com/attachment/ticket/5422/save-send-raw-flag.diff
in order for fixtures to work with django mptt...

I applied the patch but still I get an error like
"problem installing fixutre 'myfixture': mytable.lft may not be NULL

could anyone tell me how I can get past this problem?  [I also want
the hierachy issue taken care of while loading fixutres, i.e. I want
to make sure the "lft" "rght" "tree_id" and "level" field properly
populated while using the loadata]

thanks in advance,
Oumer

PS; while I was looking at the patch, I found that in my current
version of django,  the second line of dispatch to be changed was

dispatcher.send(signal=signals.post_save, sender=self.__class__,
               instance=self, created=(not record_exists))

instead of
dispatcher.send(signal=signals.post_save, sender=self.__class__,
               instance=self, created=(not record_exists))

so I still kept the created attribute but added raw=raw... 
Oct 12, 2008
Project Member #1 jonathan.buchanan
Can't duplicate this - fixture loading works for me.

The models which are being dumped to fixtures should already have had their tree
details populated when they were initially being inserted, so NULLs shouldn't be an
issue.
Status: Invalid