summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-02-13 04:42:40 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-02-13 04:42:40 -0300
commitfa86b35b8adb2433ec792556c66be33a8d143dea (patch)
treee4180790580c5a59ff7f61fca86707a219e24422
parentf41a687731d8de40ed7be70a5fd37de96765ee4a (diff)
downloadaskbot-fa86b35b8adb2433ec792556c66be33a8d143dea.tar.gz
askbot-fa86b35b8adb2433ec792556c66be33a8d143dea.tar.bz2
askbot-fa86b35b8adb2433ec792556c66be33a8d143dea.zip
added management command to build cache for the thread summaries
-rw-r--r--askbot/doc/source/changelog.rst1
-rw-r--r--askbot/management/commands/build_thread_summary_cache.py10
2 files changed, 11 insertions, 0 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index ac809dce..39f3f22e 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -14,6 +14,7 @@ Development version (not released yet)
amazon S3 for some reason adds weird expiration parameters (Evgeny)
* Reduced memory usage in data migrations (Evgeny)
* Added progress bars to slow data migrations (Evgeny)
+* Added management command to rebuild cache summary for threads (Evgeny)
0.7.39 (Jan 11, 2012)
---------------------
diff --git a/askbot/management/commands/build_thread_summary_cache.py b/askbot/management/commands/build_thread_summary_cache.py
new file mode 100644
index 00000000..854843fe
--- /dev/null
+++ b/askbot/management/commands/build_thread_summary_cache.py
@@ -0,0 +1,10 @@
+from django.core.management.base import NoArgsCommand
+from askbot.models import Thread
+from askbot.utils.console import ProgressBar
+
+class Command(NoArgsCommand):
+ def handle_noargs(self, **options):
+ message = "Rebuilding thread summary cache"
+ count = Thread.objects.count()
+ for thread in ProgressBar(Thread.objects.iterator(), count, message):
+ thread.update_summary_html()