askbot.models.question

class askbot.models.question.AnonymousQuestion(*args, **kwargs)

Bases: askbot.models.base.AnonymousContent

AnonymousQuestion(id, session_key, wiki, added_at, ip_addr, author_id, text, summary, title, tagnames)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception AnonymousQuestion.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

AnonymousQuestion.author
AnonymousQuestion.get_next_by_added_at(*moreargs, **morekwargs)
AnonymousQuestion.get_previous_by_added_at(*moreargs, **morekwargs)
AnonymousQuestion.publish(user)
class askbot.models.question.FavoriteQuestion(*args, **kwargs)

Bases: django.db.models.base.Model

A favorite Question of a User.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception FavoriteQuestion.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

FavoriteQuestion.get_next_by_added_at(*moreargs, **morekwargs)
FavoriteQuestion.get_previous_by_added_at(*moreargs, **morekwargs)
FavoriteQuestion.question
FavoriteQuestion.user
class askbot.models.question.Question(*args, **kwargs)

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

Question(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, title, answer_accepted, closed, closed_by_id, closed_at, close_reason, answer_count, view_count, favourite_count, last_activity_at, last_activity_by_id, tagnames, summary)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Question.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Question.add_revision(author=None, text=None, comment=None, revised_at=None)
Question.anonymous_answers
Question.answers
Question.apply_edit(edited_at=None, edited_by=None, title=None, text=None, comment=None, tags=None, wiki=False)
Question.author
Question.closed_by
Question.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.

Question.delete()
Question.deleted_by
Question.favorited_by
Question.favoritequestion_set
Question.flagged_items

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.

Question.followed_by
Question.get_absolute_url(*moreargs, **morekwargs)
Question.get_answer_count_by_user(user_id)
Question.get_close_reason_display(*moreargs, **morekwargs)
Question.get_last_update_info()
Question.get_next_by_added_at(*moreargs, **morekwargs)
Question.get_next_by_last_activity_at(*moreargs, **morekwargs)
Question.get_origin_post()
Question.get_previous_by_added_at(*moreargs, **morekwargs)
Question.get_previous_by_last_activity_at(*moreargs, **morekwargs)
Question.get_question_title()
Question.get_response_receivers(exclude_list=None)

returns list of users who might be interested in the question update based on their participation in the question activity

exclude_list is mandatory - it normally should have the author of the update so the he/she is not notified about the update

Question.get_revision_url()
Question.get_update_summary(last_reported_at=None, recipient_email='')
Question.get_updated_activity_data(created=False)
Question.has_favorite_by_user(user)
Question.last_activity_by
Question.last_edited_by
Question.locked_by
Question.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

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

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

Question.repute_set
Question.retag(retagged_by=None, retagged_at=None, tagnames=None)
Question.revisions
Question.save(**kwargs)

Overridden to manually manage addition of tags when the object is first saved.

This is required as we’re using tagnames as the sole means of adding and editing tags.

Question.tagname_list()

Creates a list of Tag names from the tagnames attribute.

Question.tagname_meta_generator()
Question.tags
Question.viewed
Question.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.question.QuestionManager

Bases: django.db.models.manager.Manager

create_new(title=None, author=None, added_at=None, wiki=False, tagnames=None, text=None)
get_author_list(**kwargs)
get_question_and_answer_contributors(question_list)
get_similar_questions(question)

Get 10 similar questions for given one. This will search the same tag list for give question(by exactly same string) first. Questions with the individual tags will be added to list if above questions are not full.

all parameters are guaranteed to be clean however may not relate to database - in that case a relvant filter will be silently dropped

update_answer_count(question)

Executes an UPDATE query to update denormalised data with the number of answers the given question has.

update_favorite_count(question)

update favourite_count for given question

update_tags(question, tagnames, user)

Updates Tag associations for a question to match the given tagname string.

Returns True if tag usage counts were updated as a result, False otherwise.

update_view_count(question)

update counter+1 when user browse question page

class askbot.models.question.QuestionRevision(*args, **kwargs)

Bases: askbot.models.base.ContentRevision

A revision of a Question.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception QuestionRevision.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

QuestionRevision.author
QuestionRevision.get_absolute_url(*moreargs, **morekwargs)
QuestionRevision.get_next_by_revised_at(*moreargs, **morekwargs)
QuestionRevision.get_previous_by_revised_at(*moreargs, **morekwargs)
QuestionRevision.get_question_title()
QuestionRevision.question
QuestionRevision.save(**kwargs)

Looks up the next available revision number.

class askbot.models.question.QuestionView(*args, **kwargs)

Bases: django.db.models.base.Model

QuestionView(id, question_id, who_id, when)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception QuestionView.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

QuestionView.get_next_by_when(*moreargs, **morekwargs)
QuestionView.get_previous_by_when(*moreargs, **morekwargs)
QuestionView.question
QuestionView.who

This Page