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)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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.
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.
returns query set for answers to this question that may be shown to the given user
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
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
return number of tags in the other question that overlap with the current question (self)
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
generic method to use with posts to be used prior to saving post edit or addition
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.
Creates a list of Tag names from the tagnames attribute.
updates the denormalized field ‘answer_count’ on the question
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.
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.
Bases: askbot.models.base.ContentRevision
A revision of a Question.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Looks up the next available revision number.
Bases: django.db.models.base.Model
QuestionView(id, question_id, who_id, when)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: django.db.models.base.Model
A favorite Question of a User.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: askbot.models.base.AnonymousContent
AnonymousQuestion(id, session_key, wiki, added_at, ip_addr, author_id, text, summary, title, tagnames)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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.
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.
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
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
generic method to use with posts to be used prior to saving post edit or addition
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.
Bases: askbot.models.base.ContentRevision
A revision of an Answer.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Looks up the next available revision number if not set.
Bases: askbot.models.base.AnonymousContent
AnonymousAnswer(id, session_key, wiki, added_at, ip_addr, author_id, text, summary, question_id)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: askbot.models.base.DeletableContent
Tag(id, deleted, deleted_at, deleted_by_id, name, created_by_id, used_count)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent
Comment(id, user_id, content_type_id, object_id, comment, added_at, html)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Provides a generic relation to any object through content-type/object-id fields.
deletes comment and concomitant response activity records, as well as mention records, while preserving integrity or response counts for the users
get list of users who want instant notifications about this post
argument potential_subscribers is required as it saves on db hits
get list of users who authored comments on a post and the post itself
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
generic method to use with posts to be used prior to saving post edit or addition
Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent
Vote(id, user_id, content_type_id, object_id, vote, voted_at)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
cancel the vote while taking into account whether vote was up or down
return change in score on the post
Provides a generic relation to any object through content-type/object-id fields.
Bases: askbot.models.base.MetaContent, askbot.models.base.UserContent
A flag on a Question or Answer indicating offensive content.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Provides a generic relation to any object through content-type/object-id fields.
Bases: django.db.models.base.Model
MarkedTag(id, tag_id, user_id, reason)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: django.db.models.base.Model
Awarded for notable actions performed on the site by Users.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Bases: django.db.models.base.Model
The awarding of a Badge to a User.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Provides a generic relation to any object through content-type/object-id fields.
Bases: django.db.models.base.Model
The reputation histories for user
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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
Bases: django.db.models.base.Model
We keep some history data for user activities
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
Provides a generic relation to any object through content-type/object-id fields.
Bases: django.db.models.base.Model
EmailFeedSetting(id, subscriber_id, feed_type, frequency, added_at, reported_at)
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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
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.
Bases: django.core.exceptions.ObjectDoesNotExist
Bases: django.core.exceptions.MultipleObjectsReturned
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)
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
assertion that raises exceptions.PermissionDenied when user is not authorised to edit this post
same as user_can_post_question
raises exceptions.PermissionDenied if user cannot post comment
the reason will be in text of exception
raises exceptions.PermissionDenied with text that has the reason for the denial
can_restore_rule is the same as can_delete
raises exceptions.PermissionDenied if old vote cannot be revoked due to age of the vote
attn: this assertion is independently coded in Question.get_answers call
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
Returns a boolean of whether the raw_password was correct. Handles encryption formats behind the scenes.
decrement response count for the user by one, log critical error if count would go below zero but limit decrementation at zero exactly
generic delete method for all kinds of posts
if there is no use cases for it, the method will be removed
Sends an e-mail to this User.
Returns the first_name plus the last_name, with a space in between.
Returns a list of permission strings that this user has through his/her groups. This method queries all available auth backends.
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
Returns site-specific profile for this user. Raises SiteProfileNotAvailable if this site does not allow profiles.
Returns the URL for this User’s profile.
returns number of votes that are still available to the user today
Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above.
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.
Returns True if the user has each of the specified permissions.
increment response counter for user by one
Always returns False. This is a way of comparing User objects to anonymous users.
Always return True. This is a way to tell if the user has been authenticated in templates.
add or subtract reputation of other user
post a comment on behalf of the user to parent_post
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
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
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