diff options
Diffstat (limited to 'askbot/models/answer.py')
-rw-r--r-- | askbot/models/answer.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/askbot/models/answer.py b/askbot/models/answer.py index a01b6e81..eb8b4be8 100644 --- a/askbot/models/answer.py +++ b/askbot/models/answer.py @@ -38,21 +38,17 @@ class AnswerManager(models.Manager): ) #update question data - question.last_activity_at = added_at - question.last_activity_by = author - question.answer_count +=1 - question.save() + question.thread.set_last_activity(last_activity_at=added_at, last_activity_by=author) + + question.thread.answer_count +=1 + question.thread.save() #set notification/delete if email_notify: - if author not in question.followed_by.all(): - question.followed_by.add(author) + question.thread.followed_by.add(author) else: - #not sure if this is necessary. ajax should take care of this... - try: - question.followed_by.remove(author) - except: - pass + question.thread.followed_by.remove(author) + return answer #todo: I think this method is not being used anymore, I'll just comment it for now @@ -74,10 +70,6 @@ class AnswerManager(models.Manager): class Answer(content.Content): post_type = 'answer' question = models.ForeignKey('Question', related_name='answers') - #todo: probably remove these denormalized fields? - accepted = models.BooleanField(default=False) - accepted_at = models.DateTimeField(null=True, blank=True) - #todo: we'll need to add "accepted_by" b/c sometimes non-askers can accept objects = AnswerManager() |