heroku
This commit is contained in:
parent
8957a71ef9
commit
391ac1beaa
@ -30,7 +30,9 @@ def font_size(self):
|
|||||||
max_font = 28
|
max_font = 28
|
||||||
v = Tag.objects.all().annotate(c = Count('post')).filter(c__gt = 0).aggregate(Min('c'), Max('c'))
|
v = Tag.objects.all().annotate(c = Count('post')).filter(c__gt = 0).aggregate(Min('c'), Max('c'))
|
||||||
max_tag, min_tag = v["c__max"], v["c__min"]
|
max_tag, min_tag = v["c__max"], v["c__min"]
|
||||||
step = (max_font - min_font)/float(max_tag-min_tag)
|
|
||||||
|
try: step = (max_font - min_font)/float(max_tag-min_tag)
|
||||||
|
except: step = 1
|
||||||
tag_count = Post.objects.filter(tags__name=self.name).count()
|
tag_count = Post.objects.filter(tags__name=self.name).count()
|
||||||
#print Tag.objects.filter(name=self.name).annotate(c = Count('post'))
|
#print Tag.objects.filter(name=self.name).annotate(c = Count('post'))
|
||||||
font = int(min_font + (tag_count-min_tag)*step)
|
font = int(min_font + (tag_count-min_tag)*step)
|
||||||
|
Loading…
Reference in New Issue
Block a user