]> git.openstreetmap.org Git - osqa.git/commitdiff
adding a management command to re-render node bodies
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 1 Nov 2011 17:23:35 +0000 (17:23 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 1 Nov 2011 17:23:35 +0000 (17:23 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1199 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/management/commands/render_bodies.py [new file with mode: 0644]

diff --git a/forum/management/commands/render_bodies.py b/forum/management/commands/render_bodies.py
new file mode 100644 (file)
index 0000000..90badaa
--- /dev/null
@@ -0,0 +1,19 @@
+# coding: utf-8
+
+from django.core.management.base import BaseCommand
+from forum.models import Node
+
+import logging
+
+class Command(BaseCommand):
+
+    def handle(self,*args, **options):
+        # Re-render node bodies
+        nodes = Node.objects.all()
+        for node in nodes:
+            try:
+                node.body = node.rendered(node.body)
+                node.save()
+                print node.body
+            except Exception, e:
+                logging.error(e)