'Override save method to update question info and take care of
updated.'

def save(self, update=True, no_notify=False, *args, **kwargs):

    new = (self.id is None)
    if new:
        page = ((self.question.num_answers / config.ANSWERS_PER_PAGE) + 1)
        self.page = page
    else:
        self.updated = datetime.now()
        self.clear_cached_html()
    super(Answer, self).save(*args, **kwargs)
    self.question.num_answers = Answer.objects.filter(question=self.question, is_spam=False).count()
    latest = Answer.objects.filter(question=self.question, is_spam=False).order_by('-created')[:1]
    self.question.last_answer = (self if new else (latest[0] if len(latest) else None))
    self.question.save(update)
    if new:
        self.question.clear_cached_contributors()
        if (not no_notify):
            from kitsune.questions.events import QuestionReplyEvent
            QuestionReplyEvent(self).fire(exclude=self.creator)
            actstream.actions.follow(self.creator, self, send_action=False, actor_only=False)
            actstream.actions.follow(self.creator, self.question, send_action=False, actor_only=False)
    if (not new):
        self.clear_cached_images()
