askbot.models

class askbot.models.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_answers(user=None)

returns query set for answers to this question that may be shown to the given user

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_similar_questions()

Get 10 similar questions for given one. Questions with the individual tags will be added to list if above questions are not full.

This function has a limitation that it will retrieve only 100 records then select 10 most similar from that list as querying entire database may be very expensive - this function will benefit from some sort of optimization

Question.get_similarity(other_question=None)

return number of tags in the other question that overlap with the current question (self)

Question.get_tag_names()
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.update_answer_count(save=True)

updates the denormalized field ‘answer_count’ on the question

Question.update_tags(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.

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.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.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
class askbot.models.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.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.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.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.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.

Answer.get_absolute_url(*moreargs, **morekwargs)
Answer.get_next_by_added_at(*moreargs, **morekwargs)
Answer.get_origin_post()
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.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.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.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.

class askbot.models.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.Tag(*args, **kwargs)

Bases: askbot.models.base.DeletableContent

Tag(id, deleted, deleted_at, deleted_by_id, name, created_by_id, used_count)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Tag.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Tag.created_by
Tag.deleted_by
Tag.questions
Tag.user_selections
class askbot.models.Comment(*args, **kwargs)

Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent

Comment(id, user_id, content_type_id, object_id, comment, added_at, html)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Comment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Comment.content_object

Provides a generic relation to any object through content-type/object-id fields.

Comment.content_type
Comment.delete(**kwargs)

deletes comment and concomitant response activity records, as well as mention records, while preserving integrity or response counts for the users

Comment.get_absolute_url(*moreargs, **morekwargs)
Comment.get_instant_notification_subscribers(potential_subscribers=None, mentioned_users=None, exclude_list=None)

get list of users who want instant notifications about this post

argument potential_subscribers is required as it saves on db hits

Comment.get_latest_revision_number()
Comment.get_next_by_added_at(*moreargs, **morekwargs)
Comment.get_origin_post()
Comment.get_owner()
Comment.get_previous_by_added_at(*moreargs, **morekwargs)
Comment.get_response_receivers(exclude_list=None)

get list of users who authored comments on a post and the post itself

Comment.get_text()
Comment.get_time_of_last_edit()
Comment.get_updated_activity_data(created=False)
Comment.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

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

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

Comment.set_text(text)
Comment.user
class askbot.models.Vote(*args, **kwargs)

Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent

Vote(id, user_id, content_type_id, object_id, vote, voted_at)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Vote.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Vote.cancel()

cancel the vote while taking into account whether vote was up or down

return change in score on the post

Vote.content_object

Provides a generic relation to any object through content-type/object-id fields.

Vote.content_type
Vote.get_next_by_voted_at(*moreargs, **morekwargs)
Vote.get_previous_by_voted_at(*moreargs, **morekwargs)
Vote.get_vote_display(*moreargs, **morekwargs)
Vote.is_downvote()
Vote.is_opposite(vote_type)
Vote.is_upvote()
Vote.user
class askbot.models.FlaggedItem(*args, **kwargs)

Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent

A flag on a Question or Answer indicating offensive content.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception FlaggedItem.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

FlaggedItem.content_object

Provides a generic relation to any object through content-type/object-id fields.

FlaggedItem.content_type
FlaggedItem.get_next_by_flagged_at(*moreargs, **morekwargs)
FlaggedItem.get_previous_by_flagged_at(*moreargs, **morekwargs)
FlaggedItem.user
class askbot.models.MarkedTag(*args, **kwargs)

Bases: django.db.models.base.Model

MarkedTag(id, tag_id, user_id, reason)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MarkedTag.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

MarkedTag.get_reason_display(*moreargs, **morekwargs)
MarkedTag.tag
MarkedTag.user
class askbot.models.Badge(*args, **kwargs)

Bases: django.db.models.base.Model

Awarded for notable actions performed on the site by Users.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Badge.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Badge.award_badge
Badge.awarded_to
Badge.get_absolute_url(*moreargs, **morekwargs)
Badge.get_type_display(*moreargs, **morekwargs)
Badge.save(**kwargs)
class askbot.models.Award(*args, **kwargs)

Bases: django.db.models.base.Model

The awarding of a Badge to a User.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Award.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Award.badge
Award.content_object

Provides a generic relation to any object through content-type/object-id fields.

Award.content_type
Award.get_next_by_awarded_at(*moreargs, **morekwargs)
Award.get_previous_by_awarded_at(*moreargs, **morekwargs)
Award.user
class askbot.models.Repute(*args, **kwargs)

Bases: django.db.models.base.Model

The reputation histories for user

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Repute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Repute.get_explanation_snippet()

returns HTML snippet with a link to related question or a text description for a the reason of the reputation change

in the implementation description is returned only for Repute.reputation_type == 10 - “assigned by the moderator”

part of the purpose of this method is to hide this idiosyncracy

Repute.get_next_by_reputed_at(*moreargs, **morekwargs)
Repute.get_previous_by_reputed_at(*moreargs, **morekwargs)
Repute.get_reputation_type_display(*moreargs, **morekwargs)
Repute.question
Repute.user
class askbot.models.Activity(*args, **kwargs)

Bases: django.db.models.base.Model

We keep some history data for user activities

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Activity.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Activity.content_object

Provides a generic relation to any object through content-type/object-id fields.

Activity.content_type
Activity.get_absolute_url(*moreargs, **morekwargs)
Activity.get_activity_type_display(*moreargs, **morekwargs)
Activity.get_mentioned_user()
Activity.get_next_by_active_at(*moreargs, **morekwargs)
Activity.get_previous_by_active_at(*moreargs, **morekwargs)
Activity.receiving_users
Activity.user
class askbot.models.EmailFeedSetting(*args, **kwargs)

Bases: django.db.models.base.Model

EmailFeedSetting(id, subscriber_id, feed_type, frequency, added_at, reported_at)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception EmailFeedSetting.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod EmailFeedSetting.filter_subscribers(potential_subscribers=None, feed_type=None, frequency=None)

returns set of users who have matching subscriptions and if potential_subscribers is not none, search will be limited to only potential subscribers,

otherwise search is unrestricted

todo: when EmailFeedSetting is merged into user table this method may become unnecessary

EmailFeedSetting.get_feed_type_display(*moreargs, **morekwargs)
EmailFeedSetting.get_frequency_display(*moreargs, **morekwargs)
EmailFeedSetting.get_next_by_added_at(*moreargs, **morekwargs)
EmailFeedSetting.get_previous_by_added_at(*moreargs, **morekwargs)
EmailFeedSetting.get_previous_report_cutoff_time()
EmailFeedSetting.mark_reported_now()
EmailFeedSetting.save(*args, **kwargs)
EmailFeedSetting.should_send_now()
EmailFeedSetting.subscriber
class askbot.models.User(*args, **kwargs)

Bases: django.db.models.base.Model

Users within the Django authentication system are represented by this model.

Username and password are required. Other fields are optional.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception User.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

User.accept_answer(answer, timestamp=None, cancel=False)
User.accept_best_answer(*arg, **kwarg)
User.activity_set
User.anonymousanswer_set
User.anonymousquestion_set
User.answerrevisions
User.answers
User.assert_can_accept_best_answer(answer=None)
User.assert_can_close_question(question=None)
User.assert_can_delete_answer(answer=None)

intentionally use “post” word in the messages instead of “answer”, because this logic also applies to assert on deleting question (in addition to some special rules)

User.assert_can_delete_comment(comment=None)
User.assert_can_delete_post(post=None)
User.assert_can_delete_question(question=None)

rules are the same as to delete answer, except if question has answers already, when owner cannot delete unless s/he is and adinistrator or moderator

User.assert_can_edit_answer(answer=None)
User.assert_can_edit_deleted_post(post=None)
User.assert_can_edit_post(post=None)

assertion that raises exceptions.PermissionDenied when user is not authorised to edit this post

User.assert_can_edit_question(question=None)
User.assert_can_flag_offensive(post=None)
User.assert_can_post_answer()

same as user_can_post_question

User.assert_can_post_comment(parent_post=None)

raises exceptions.PermissionDenied if user cannot post comment

the reason will be in text of exception

User.assert_can_post_question()

raises exceptions.PermissionDenied with text that has the reason for the denial

User.assert_can_reopen_question(question=None)
User.assert_can_restore_post(post=None)

can_restore_rule is the same as can_delete

User.assert_can_retag_question(question=None)
User.assert_can_revoke_old_vote(vote)

raises exceptions.PermissionDenied if old vote cannot be revoked due to age of the vote

User.assert_can_see_deleted_post(post=None)

attn: this assertion is independently coded in Question.get_answers call

User.assert_can_unaccept_best_answer(answer=None)
User.assert_can_upload_file(request_user)
User.assert_can_vote_for_post(post=None, direction=None)

raises exceptions.PermissionDenied exception if user can’t in fact upvote

:param:direction can be ‘up’ or ‘down’ :param:post can be instance of question or answer

User.award_user
User.badges
User.can_moderate_user(other)
User.check_password(raw_password)

Returns a boolean of whether the raw_password was correct. Handles encryption formats behind the scenes.

User.close_question(*arg, **kwarg)
User.closed_questions
User.comments
User.created_tags
User.decrement_response_count(user)

decrement response count for the user by one, log critical error if count would go below zero but limit decrementation at zero exactly

User.delete_answer(*arg, **kwarg)
User.delete_comment(*arg, **kwarg)
User.delete_messages()
User.delete_post(post=None, timestamp=None)

generic delete method for all kinds of posts

if there is no use cases for it, the method will be removed

User.delete_question(*arg, **kwarg)
User.deleted_answers
User.deleted_questions
User.deleted_tags
User.downvote(post, timestamp=None, cancel=False)
User.edit_answer(*arg, **kwarg)
User.edit_question(*arg, **kwarg)
User.email_user(subject, message, from_email=None)

Sends an e-mail to this User.

User.externallogindata_set
User.favorite_questions
User.flag_post(*arg, **kwarg)
User.flaggeditems
User.follow_question(question=None)
User.followed_questions
User.get_absolute_url()
User.get_all_permissions()
User.get_and_delete_messages()
User.get_full_name()

Returns the first_name plus the last_name, with a space in between.

User.get_group_permissions()

Returns a list of permission strings that this user has through his/her groups. This method queries all available auth backends.

User.get_messages()
User.get_next_by_date_joined(*moreargs, **morekwargs)
User.get_next_by_last_login(*moreargs, **morekwargs)
User.get_next_by_last_seen(*moreargs, **morekwargs)
User.get_old_vote_for_post(post)

returns previous vote for this post by the user or None, if does not exist

raises assertion_error is number of old votes is > 1 which is illegal

User.get_previous_by_date_joined(*moreargs, **morekwargs)
User.get_previous_by_last_login(*moreargs, **morekwargs)
User.get_previous_by_last_seen(*moreargs, **morekwargs)
User.get_profile()

Returns site-specific profile for this user. Raises SiteProfileNotAvailable if this site does not allow profiles.

User.get_profile_url()

Returns the URL for this User’s profile.

User.get_q_sel_email_feed_frequency()
User.get_questions_per_page_display(*moreargs, **morekwargs)
User.get_status_display(soft=False)
User.get_tag_filter_setting_display(*moreargs, **morekwargs)
User.get_unused_votes_today()

returns number of votes that are still available to the user today

User.groups
User.has_module_perms(app_label)

Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above.

User.has_perm(perm)

Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general.

User.has_perms(perm_list)

Returns True if the user has each of the specified permissions.

User.has_usable_password()
User.increment_response_count(user)

increment response counter for user by one

User.is_administrator()
User.is_anonymous()

Always returns False. This is a way of comparing User objects to anonymous users.

User.is_approved()
User.is_authenticated()

Always return True. This is a way to tell if the user has been authenticated in templates.

User.is_blocked()
User.is_following(followed_item)
User.is_moderator()
User.is_suspended()
classmethod User.is_username_taken(username)
User.is_watched()
User.last_active_in_questions
User.last_edited_answers
User.last_edited_questions
User.locked_answers
User.locked_questions
User.logentry_set
User.message_set
User.moderate_user_reputation(*arg, **kwarg)

add or subtract reputation of other user

User.notification_subscriptions
User.post_answer(question=None, body_text=None, follow=False, wiki=False, timestamp=None)
User.post_comment(parent_post=None, body_text=None, timestamp=None)

post a comment on behalf of the user to parent_post

User.post_question(title=None, body_text=None, tags=None, wiki=False, timestamp=None)
User.question_views
User.questionrevisions
User.questions
User.received_activity
User.reopen_question(*arg, **kwarg)
User.repute_set
User.restore_post(post=None, timestamp=None)
User.retag_question(*arg, **kwarg)
User.set_password(raw_password)
User.set_status(new_status)

sets new status to user

this method understands that administrator status is stored in the User.is_superuser field, but everything else in User.status field

there is a slight aberration - administrator status can be removed, but not added yet

if new status is applied to user, then the record is committed to the database

User.set_unusable_password()
User.tag_selections
User.toggle_favorite_question(question, timestamp=None, cancel=False)

cancel has no effect here, but is important for the SE loader it is hoped that toggle will work and data will be consistent but there is no guarantee, maybe it’s better to be more strict about processing the “cancel” option another strange thing is that this function unlike others below returns a value

User.unaccept_best_answer(*arg, **kwarg)
User.unfollow_question(question=None)
User.upvote(post, timestamp=None, cancel=False)
User.user_favorite_questions
User.user_permissions
User.userassociation_set
User.userpasswordqueue_set
User.visit_question(question=None, timestamp=None)

create a QuestionView record on behalf of the user represented by the self object and mark it as taking place at timestamp time

and remove pending on-screen notifications about anything in the post - question, answer or comments

User.votes

Table Of Contents

This Page