circuit
circuit social network code-documentation
|
Inherits Model.
Public Member Functions | |
def | original_or_self (self) |
def | get_number_of_favorites (self) |
def | get_number_of_reposts (self) |
def | set_post_extra (self, request) |
def | save_hashtags (self, hashtags) |
def | check_repost (self, user) |
def | check_reply (self, user) |
def | __str__ (self) |
Static Public Member Functions | |
def | parse_content (content) |
def | content_is_valid (content) |
def | image_is_valid (image) |
def | visible_posts_for (user) |
Static Public Attributes | |
tuple | content = models.CharField(max_length=256) |
tuple | author = models.ForeignKey(User) |
tuple | repost_original = models.ForeignKey('self', null=True, blank=True, related_name='repost') |
tuple | reply_original = models.ForeignKey('self', null=True, blank=True, related_name='reply') |
tuple | created_at = models.DateTimeField(auto_now_add=True) |
tuple | updated_at = models.DateTimeField(auto_now=True) |
tuple | favorites = models.ManyToManyField(User, related_name='favorites') |
tuple | circles = models.ForeignKey(Circle, null=True, blank=True, related_name='circles') |
tuple | image |
Post model that stores all information of a post
def posts.models.Post.__str__ | ( | self | ) |
def posts.models.Post.check_reply | ( | self, | |
user | |||
) |
Checks if a post can be replied to @param user: the user that wants to reply to a post. @return: 'not_auth' in case the user isn't authenticated, 'ok' otherwise.
def posts.models.Post.check_repost | ( | self, | |
user | |||
) |
Check if a post can be reposted by a user. @param self: the post to repost @param user: the user that wants to repost @return `ok` if the post can be reposted by the user, a different error string otherwise
|
static |
def posts.models.Post.get_number_of_favorites | ( | self | ) |
def posts.models.Post.get_number_of_reposts | ( | self | ) |
|
static |
def posts.models.Post.original_or_self | ( | self | ) |
Helper method for getting the original post of a repost. Loops until the original is found to avoid database inconsistencies. @return `self.repost_original` if set, `self` otherwise
|
static |
def posts.models.Post.save_hashtags | ( | self, | |
hashtags | |||
) |
def posts.models.Post.set_post_extra | ( | self, | |
request | |||
) |
Add an `extra` attribute to a post for easy information access in a template. @param self: the post to add extra information to @param request: the request for which information is added
|
static |
Returns a pre-filtered query object containing all posts visible for the specified user. @param user: instance of the User model
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |