askbot.models.answer

class askbot.models.answer.AnonymousAnswer(*args, **kwargs)

Bases: askbot.models.base.AnonymousContent

AnonymousAnswer(id, session_key, wiki, added_at, ip_addr, author_id, text, summary, question_id)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception AnonymousAnswer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

AnonymousAnswer.author
AnonymousAnswer.get_next_by_added_at(*moreargs, **morekwargs)
AnonymousAnswer.get_previous_by_added_at(*moreargs, **morekwargs)
AnonymousAnswer.publish(user)
AnonymousAnswer.question
class askbot.models.answer.Answer(*args, **kwargs)

Bases: askbot.models.content.Content, askbot.models.base.DeletableContent

Answer(id, deleted, deleted_at, deleted_by_id, author_id, added_at, wiki, wikified_at, locked, locked_by_id, locked_at, score, vote_up_count, vote_down_count, comment_count, offensive_flag_count, last_edited_at, last_edited_by_id, html, text, question_id, accepted, accepted_at)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Answer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Answer.add_revision(author=None, revised_at=None, text=None, comment=None)
Answer.apply_edit(edited_at=None, edited_by=None, text=None, comment=None, wiki=False)
Answer.assert_is_visible_to(user)

raises QuestionHidden or AnswerHidden

Answer.author
Answer.comments

This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.

Answer.deleted_by
Answer.get_absolute_url(*moreargs, **morekwargs)
Answer.get_next_by_added_at(*moreargs, **morekwargs)
Answer.get_origin_post()
Answer.get_page_number(answers=None)

When question has many answers, answers are paginated. This function returns number of the page on which the answer will be shown, using the default sort order. The result may depend on the visitor.

Answer.get_previous_by_added_at(*moreargs, **morekwargs)
Answer.get_question_title()
Answer.get_response_receivers(exclude_list=None)

get list of users interested in this response update based on their participation in the question activity

exclude_list is required and normally should contain author of the updated so that he/she is not notified of the response

Answer.get_updated_activity_data(created=False)
Answer.get_user_vote(user)
Answer.last_edited_by
Answer.locked_by
Answer.parse(post)

typically post has a field to store raw source text in comment it is called .comment, in Question and Answer it is called .text also there is another field called .html (consistent across models) so the goal of this function is to render raw text into .html and extract any metadata given stored in source (currently this metadata is limited by twitter style @mentions but there may be more in the future

function returns a dictionary with the following keys html newly_mentioned_users - list of <User> objects removed_mentions - list of mention <Activity> objects - for removed ones

Answer.parse_and_save(post, author=None, **kwargs)

generic method to use with posts to be used prior to saving post edit or addition

Answer.question
Answer.revisions
Answer.save(*args, **kwargs)
Answer.votes

This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.

class askbot.models.answer.AnswerManager

Bases: django.db.models.manager.Manager

create_new(question=None, author=None, added_at=None, wiki=False, text='', email_notify=False)
get_author_list(**kwargs)
class askbot.models.answer.AnswerRevision(*args, **kwargs)

Bases: askbot.models.base.ContentRevision

A revision of an Answer.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception AnswerRevision.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

AnswerRevision.answer
AnswerRevision.as_html()
AnswerRevision.author
AnswerRevision.get_absolute_url(*moreargs, **morekwargs)
AnswerRevision.get_next_by_revised_at(*moreargs, **morekwargs)
AnswerRevision.get_previous_by_revised_at(*moreargs, **morekwargs)
AnswerRevision.get_question_title()
AnswerRevision.save(**kwargs)

Looks up the next available revision number if not set.

This Page