summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/migrations/0050_move_qa_revisions_to_postrevision.py4
-rw-r--r--askbot/migrations/0053_create_threads_for_questions.py2
-rw-r--r--askbot/migrations/0057_transplant_answer_count_data.py2
-rw-r--r--askbot/migrations/0060_view_count_transplant.py2
-rw-r--r--askbot/migrations/0063_transplant_question_closed_datas.py2
-rw-r--r--askbot/migrations/0069_transplant_last_activity_data.py2
-rw-r--r--askbot/migrations/0072_transplant_tagnames_data.py2
-rw-r--r--askbot/migrations/0075_transplant_followed_by_data.py4
-rw-r--r--askbot/migrations/0079_transplant_favquestions_data.py2
-rw-r--r--askbot/migrations/0082_transplant_title_data.py2
-rw-r--r--askbot/migrations/0086_transplant_question_tags_data.py4
-rw-r--r--askbot/migrations/0090_postize_q_a_c.py6
-rw-r--r--askbot/migrations/0092_postize_vote_and_activity.py4
-rw-r--r--askbot/migrations/0095_postize_award_and_repute.py9
-rw-r--r--askbot/migrations/0098_postize_thread_anonanswer_questionview_postrevision.py8
-rw-r--r--askbot/skins/default/templates/question/sidebar.html3
16 files changed, 29 insertions, 29 deletions
diff --git a/askbot/migrations/0050_move_qa_revisions_to_postrevision.py b/askbot/migrations/0050_move_qa_revisions_to_postrevision.py
index 36c46551..e4d0ea3b 100644
--- a/askbot/migrations/0050_move_qa_revisions_to_postrevision.py
+++ b/askbot/migrations/0050_move_qa_revisions_to_postrevision.py
@@ -42,10 +42,10 @@ class Migration(DataMigration):
def forwards(self, orm):
# Process revisions
- for qr in orm.QuestionRevision.objects.all():
+ for qr in orm.QuestionRevision.objects.iterator():
self.copy_revision(orm=orm, source_revision=qr)
- for ar in orm.AnswerRevision.objects.all():
+ for ar in orm.AnswerRevision.objects.iterator():
self.copy_revision(orm=orm, source_revision=ar)
diff --git a/askbot/migrations/0053_create_threads_for_questions.py b/askbot/migrations/0053_create_threads_for_questions.py
index e2fe0d40..56f826b9 100644
--- a/askbot/migrations/0053_create_threads_for_questions.py
+++ b/askbot/migrations/0053_create_threads_for_questions.py
@@ -8,7 +8,7 @@ class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = orm.Thread.objects.create(favourite_count=question.favourite_count)
question.thread = thread
question.save()
diff --git a/askbot/migrations/0057_transplant_answer_count_data.py b/askbot/migrations/0057_transplant_answer_count_data.py
index bd831f66..654f9793 100644
--- a/askbot/migrations/0057_transplant_answer_count_data.py
+++ b/askbot/migrations/0057_transplant_answer_count_data.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = question.thread
thread.answer_count = question.answer_count
thread.save()
diff --git a/askbot/migrations/0060_view_count_transplant.py b/askbot/migrations/0060_view_count_transplant.py
index 07fb13d4..db3ab49b 100644
--- a/askbot/migrations/0060_view_count_transplant.py
+++ b/askbot/migrations/0060_view_count_transplant.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = question.thread
thread.view_count = question.view_count
thread.save()
diff --git a/askbot/migrations/0063_transplant_question_closed_datas.py b/askbot/migrations/0063_transplant_question_closed_datas.py
index b2302d33..052dc268 100644
--- a/askbot/migrations/0063_transplant_question_closed_datas.py
+++ b/askbot/migrations/0063_transplant_question_closed_datas.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = question.thread
thread.closed = question.closed
diff --git a/askbot/migrations/0069_transplant_last_activity_data.py b/askbot/migrations/0069_transplant_last_activity_data.py
index 5d612254..a0756d68 100644
--- a/askbot/migrations/0069_transplant_last_activity_data.py
+++ b/askbot/migrations/0069_transplant_last_activity_data.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = question.thread
thread.last_activity_at = question.last_activity_at
thread.last_activity_by = question.last_activity_by
diff --git a/askbot/migrations/0072_transplant_tagnames_data.py b/askbot/migrations/0072_transplant_tagnames_data.py
index 3d3fc92a..5f95fe07 100644
--- a/askbot/migrations/0072_transplant_tagnames_data.py
+++ b/askbot/migrations/0072_transplant_tagnames_data.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
thread = question.thread
thread.tagnames = question.tagnames
thread.save()
diff --git a/askbot/migrations/0075_transplant_followed_by_data.py b/askbot/migrations/0075_transplant_followed_by_data.py
index 822300ff..19529b2f 100644
--- a/askbot/migrations/0075_transplant_followed_by_data.py
+++ b/askbot/migrations/0075_transplant_followed_by_data.py
@@ -7,9 +7,9 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
question.thread.followed_by.clear() # just in case someone reversed this migration
- question.thread.followed_by.add(*list(question.followed_by.all()))
+ question.thread.followed_by.add(*list(question.followed_by.iterator()))
if question.followed_by.count() != question.thread.followed_by.count():
raise ValueError("There are Thread instances for which data doesn't match Question!")
diff --git a/askbot/migrations/0079_transplant_favquestions_data.py b/askbot/migrations/0079_transplant_favquestions_data.py
index 351dc7f8..eb776f0d 100644
--- a/askbot/migrations/0079_transplant_favquestions_data.py
+++ b/askbot/migrations/0079_transplant_favquestions_data.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for fav in orm.FavoriteQuestion.objects.all():
+ for fav in orm.FavoriteQuestion.objects.iterator():
fav.thread = fav.question.thread
fav.save()
diff --git a/askbot/migrations/0082_transplant_title_data.py b/askbot/migrations/0082_transplant_title_data.py
index 6f4a07d6..cb9f6c1c 100644
--- a/askbot/migrations/0082_transplant_title_data.py
+++ b/askbot/migrations/0082_transplant_title_data.py
@@ -7,7 +7,7 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
+ for question in orm.Question.objects.iterator():
question.thread.title = question.title
question.thread.save()
diff --git a/askbot/migrations/0086_transplant_question_tags_data.py b/askbot/migrations/0086_transplant_question_tags_data.py
index a7508229..bcb2a48f 100644
--- a/askbot/migrations/0086_transplant_question_tags_data.py
+++ b/askbot/migrations/0086_transplant_question_tags_data.py
@@ -7,8 +7,8 @@ from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
- for question in orm.Question.objects.all():
- question.thread.tags.add(*list(question.tags.all()))
+ for question in orm.Question.objects.iterator():
+ question.thread.tags.add(*list(question.tags.iterator()))
if orm.Question.objects.annotate(tag_num=models.Count('tags'), thread_tag_num=models.Count('thread__tags')).exclude(tag_num=models.F('thread_tag_num')).exists():
raise ValueError("There are Thread instances for which data doesn't match Question!")
diff --git a/askbot/migrations/0090_postize_q_a_c.py b/askbot/migrations/0090_postize_q_a_c.py
index f85cbf09..3d3a7b44 100644
--- a/askbot/migrations/0090_postize_q_a_c.py
+++ b/askbot/migrations/0090_postize_q_a_c.py
@@ -26,7 +26,7 @@ class Migration(DataMigration):
if 'test' not in sys.argv: # Don't confuse users
print TERM_GREEN, '[DEBUG] Initial Post.id ==', post_id + 1, TERM_RESET
- for q in orm.Question.objects.all():
+ for q in orm.Question.objects.iterator():
post_id += 1
orm.Post.objects.create(
id=post_id,
@@ -67,7 +67,7 @@ class Migration(DataMigration):
is_anonymous=q.is_anonymous,
)
- for ans in orm.Answer.objects.all():
+ for ans in orm.Answer.objects.iterator():
post_id += 1
orm.Post.objects.create(
id=post_id,
@@ -108,7 +108,7 @@ class Migration(DataMigration):
is_anonymous=ans.is_anonymous,
)
- for cm in orm.Comment.objects.all():
+ for cm in orm.Comment.objects.iterator():
# Workaround for a strange issue with: http://south.aeracode.org/docs/generics.html
# No need to investigate that as this is as simple as the "proper" way
if (cm.content_type.app_label, cm.content_type.model) == ('askbot', 'question'):
diff --git a/askbot/migrations/0092_postize_vote_and_activity.py b/askbot/migrations/0092_postize_vote_and_activity.py
index 556ef18a..45442f8f 100644
--- a/askbot/migrations/0092_postize_vote_and_activity.py
+++ b/askbot/migrations/0092_postize_vote_and_activity.py
@@ -12,7 +12,7 @@ class Migration(DataMigration):
def forwards(self, orm):
# TODO: Speed this up by prefetching all votes ?
- for v in orm.Vote.objects.all():
+ for v in orm.Vote.objects.iterator():
if (v.content_type.app_label, v.content_type.model) == ('askbot', 'question'):
v.voted_post = orm.Post.objects.get(self_question__id=v.object_id)
elif (v.content_type.app_label, v.content_type.model) == ('askbot', 'answer'):
@@ -31,7 +31,7 @@ class Migration(DataMigration):
abandoned_activities = []
- for a in orm.Activity.objects.all():
+ for a in orm.Activity.objects.iterator():
# test if content_object for this activity exists - there might be a bunch of "abandoned" activities
#
# NOTE that if activity.content_object is gone then we cannot reliably recover it from activity.question
diff --git a/askbot/migrations/0095_postize_award_and_repute.py b/askbot/migrations/0095_postize_award_and_repute.py
index 0071199c..801949c2 100644
--- a/askbot/migrations/0095_postize_award_and_repute.py
+++ b/askbot/migrations/0095_postize_award_and_repute.py
@@ -11,16 +11,19 @@ class Migration(DataMigration):
# ContentType for Post model should be created no later than in migration 0092
ct_post = orm['contenttypes.ContentType'].objects.get(app_label='askbot', model='post')
- for aw in orm.Award.objects.all():
+ for aw in orm.Award.objects.iterator():
ct = aw.content_type
if ct.app_label == 'askbot' and ct.model in ('question', 'answer', 'comment'):
aw.content_type = ct_post
- aw.object_id = orm.Post.objects.get(**{'self_%s__id' % str(ct.model): aw.object_id}).id
+ try:
+ aw.object_id = orm.Post.objects.get(**{'self_%s__id' % str(ct.model): aw.object_id}).id
+ except orm.Post.DoesNotExist:
+ continue
aw.save()
###
- for rp in orm.Repute.objects.all():
+ for rp in orm.Repute.objects.iterator():
if rp.question:
rp.question_post = orm.Post.objects.get(self_question__id=rp.question.id)
rp.save()
diff --git a/askbot/migrations/0098_postize_thread_anonanswer_questionview_postrevision.py b/askbot/migrations/0098_postize_thread_anonanswer_questionview_postrevision.py
index e253613e..0fd73605 100644
--- a/askbot/migrations/0098_postize_thread_anonanswer_questionview_postrevision.py
+++ b/askbot/migrations/0098_postize_thread_anonanswer_questionview_postrevision.py
@@ -9,20 +9,20 @@ class Migration(DataMigration):
def forwards(self, orm):
# TODO: Speed this migration up by prefetching data ?
- for thread in orm.Thread.objects.all():
+ for thread in orm.Thread.objects.iterator():
if thread.accepted_answer:
thread.accepted_answer_post = orm.Post.objects.get(self_answer__id=thread.accepted_answer.id)
thread.save()
- for qv in orm.QuestionView.objects.all():
+ for qv in orm.QuestionView.objects.iterator():
qv.question_post = orm.Post.objects.get(self_question__id=qv.question.id)
qv.save()
- for aa in orm.AnonymousAnswer.objects.all():
+ for aa in orm.AnonymousAnswer.objects.iterator():
aa.question_post = orm.Post.objects.get(self_question__id=aa.question.id)
aa.save()
- for rev in orm.PostRevision.objects.all():
+ for rev in orm.PostRevision.objects.iterator():
if rev.question:
assert not rev.answer
rev.post = orm.Post.objects.get(self_question__id=rev.question.id)
diff --git a/askbot/skins/default/templates/question/sidebar.html b/askbot/skins/default/templates/question/sidebar.html
index bc6a58c9..08c043a6 100644
--- a/askbot/skins/default/templates/question/sidebar.html
+++ b/askbot/skins/default/templates/question/sidebar.html
@@ -37,8 +37,6 @@
</p>
</div>
</div>
-{% cache 0 "questions_tags" questions_tags question.id language_code %}
-
{% if settings.SIDEBAR_QUESTION_SHOW_META %}
<div class="box statsWidget">
@@ -55,7 +53,6 @@
</p>
</div>
{% endif %}
-{% endcache %}
{% if similar_threads.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %}
{#% cache 1800 "related_questions" related_questions question.id language_code %#}