load_bulk() class method errors out when node has a foreign key to another model
I am trying to make a copy of a node and all descendants. If I do a dump_bulk() and then try a load_bulk() it errors out if any of the nodes within the branch I am dumping and loading has a foreign key.
I get the following error: ValueError: Cannot assign "1L": "CourseObject.asset" must be a "Asset" instance.
Here's my model:
class CourseObject(MP_Node): name = models.CharField(max_length=200) is_supplemental = models.BooleanField() is_active = models.BooleanField(default=True) asset = models.ForeignKey(Asset, blank=True, null=True) added_date = models.DateField(auto_now_add=True) modified_date = models.DateField(auto_now=True)
So it is expecting an instance of the object and it is getting an id value instead...
Anyone know why I am getting this error or if there is another way to copy a node and all of its descendants?