summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-08-19 12:12:46 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-08-19 12:12:46 -0400
commitdcce84ababcc501e017627c8bfa103df6600f58b (patch)
tree800103944a247adb11db50473f4a11838596c73a
parent94f48ce9e61567ac827f12b72ecafa75ace78d70 (diff)
downloadaskbot-dcce84ababcc501e017627c8bfa103df6600f58b.tar.gz
askbot-dcce84ababcc501e017627c8bfa103df6600f58b.tar.bz2
askbot-dcce84ababcc501e017627c8bfa103df6600f58b.zip
added fix_answer_counts command and removed the useless mailserver setting in default settings.py file
-rw-r--r--askbot/management/commands/fix_answer_counts.py31
-rw-r--r--askbot/setup_templates/settings.py6
2 files changed, 34 insertions, 3 deletions
diff --git a/askbot/management/commands/fix_answer_counts.py b/askbot/management/commands/fix_answer_counts.py
new file mode 100644
index 00000000..3bb7f7d4
--- /dev/null
+++ b/askbot/management/commands/fix_answer_counts.py
@@ -0,0 +1,31 @@
+"""fix_answer_counts management command
+to run type (on the command line:)
+
+python manage.py fix_answer_counts
+"""
+from django.core.management.base import NoArgsCommand
+from django.db.models import signals
+from askbot import models
+
+class Command(NoArgsCommand):
+ """Command class for "fix_answer_counts"
+ """
+
+ def remove_save_signals(self):
+ """removes signals on model pre-save and
+ post-save, so that there are no side-effects
+ besides actually updating the answer counts
+ """
+ signals.pre_save.receivers = []
+ signals.post_save.receivers = []
+
+ def handle(self, *arguments, **options):
+ """function that handles the command job
+ """
+ self.remove_save_signals()
+ questions = models.Question.objects.all()
+ for question in questions:
+ #todo: must be simply
+ #question.update_answer_count()
+ models.Question.objects.update_answer_count(question)
+ question.save()
diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py
index 3bee538f..4117880e 100644
--- a/askbot/setup_templates/settings.py
+++ b/askbot/setup_templates/settings.py
@@ -29,9 +29,9 @@ SERVER_EMAIL = ''
DEFAULT_FROM_EMAIL = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
-EMAIL_SUBJECT_PREFIX = '[ASKBOT] '
-EMAIL_HOST='askbot.org'
-EMAIL_PORT='25'
+EMAIL_SUBJECT_PREFIX = ''
+EMAIL_HOST=''
+EMAIL_PORT=''
EMAIL_USE_TLS=False
# Local time zone for this installation. Choices can be found here: