##// END OF EJS Templates
Small updates to the tag model docstrings.
neko259 -
r623:da7c40d0 default
parent child Browse files
Show More
@@ -15,6 +15,10 b' ARCHIVE_POPULARITY_MODIFIER = 0.5'
15 15 class TagManager(models.Manager):
16 16
17 17 def get_not_empty_tags(self):
18 """
19 Gets tags that have non-archived threads.
20 """
21
18 22 tags = self.annotate(Count('threads')) \
19 23 .filter(threads__count__gt=0).filter(threads__archived=False) \
20 24 .order_by('name')
@@ -42,13 +46,22 b' class Tag(models.Model):'
42 46 return self.name
43 47
44 48 def is_empty(self):
49 """
50 Checks if the tag has some threads.
51 """
52
45 53 return self.get_thread_count() == 0
46 54
47 55 def get_thread_count(self):
48 56 return self.threads.count()
49 57
50 58 def get_popularity(self):
51 all_post_count = Post.objects.all().count()
59 """
60 Gets tag's popularity value as a percentage of overall board post
61 count.
62 """
63
64 all_post_count = Post.objects.count()
52 65
53 66 tag_reply_count = 0.0
54 67
@@ -61,6 +74,10 b' class Tag(models.Model):'
61 74 return popularity
62 75
63 76 def get_linked_tags(self):
77 """
78 Gets tags linked to the current one.
79 """
80
64 81 tag_list = []
65 82 self.get_linked_tags_list(tag_list)
66 83
@@ -80,7 +97,9 b' class Tag(models.Model):'
80 97 linked_tag.get_linked_tags_list(tag_list)
81 98
82 99 def get_font_value(self):
83 """Get tag font value to differ most popular tags in the list"""
100 """
101 Gets tag font value to differ most popular tags in the list
102 """
84 103
85 104 popularity = self.get_popularity()
86 105
@@ -91,6 +110,10 b' class Tag(models.Model):'
91 110 return str(font_value)
92 111
93 112 def get_post_count(self, archived=False):
113 """
114 Gets posts count for the tag's threads.
115 """
116
94 117 posts_count = 0
95 118
96 119 threads = self.threads.filter(archived=archived)
General Comments 0
You need to be logged in to leave comments. Login now