print "\nConverting %d comments:" % c_count\r
progress = ProgressBar(c_count)\r
\r
+ id_map = {}\r
+\r
for c in orm.Comment.objects.all():\r
node = orm.Node(\r
node_type='comment',\r
)\r
node.save()\r
\r
+ id_map[c.id] = node\r
+\r
revision = orm.NodeRevision(\r
summary="Initial revsion",\r
revision=1,\r
progress.update()\r
\r
print "\n...done\n"\r
+\r
+ ctype = orm['contenttypes.ContentType'].objects.get(name="comment").id\r
+ ntype = orm['contenttypes.ContentType'].objects.get(name="node").id\r
+\r
+ #Converting activity\r
+ activities = orm.Activity.objects.filter(content_type__id=ctype)\r
+ activity_count = activities.count()\r
+ print "Converting %d activity references:" % activity_count\r
+ progress = ProgressBar(activity_count)\r
+\r
+ for a in activities:\r
+ node = id_map.get(a.object_id, None)\r
+ if node:\r
+ a.content_type_id = ntype\r
+ a.object_id = node.id\r
+ a.save()\r
+\r
+ progress.update()\r
+\r
+ print "\n...done\n"\r
\r
\r
def backwards(self, orm):\r