summaryrefslogtreecommitdiffstats
path: root/askbot/models/tag.py
diff options
context:
space:
mode:
authorNoahY <yuttadhammo@yahoo.com>2011-07-27 02:04:30 +0530
committerNoahY <yuttadhammo@yahoo.com>2011-07-27 02:04:30 +0530
commit183a2d20626dad6020a43a86e703a1e6557bf2d1 (patch)
tree829333ff6b85f8be293a68798e9566a16f72ac77 /askbot/models/tag.py
parent624be8cd1837bf944d92a724d68c891f0bb19155 (diff)
downloadaskbot-183a2d20626dad6020a43a86e703a1e6557bf2d1.tar.gz
askbot-183a2d20626dad6020a43a86e703a1e6557bf2d1.tar.bz2
askbot-183a2d20626dad6020a43a86e703a1e6557bf2d1.zip
added setting to switch between tag cloud and tag list
Diffstat (limited to 'askbot/models/tag.py')
-rw-r--r--askbot/models/tag.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/askbot/models/tag.py b/askbot/models/tag.py
index 9822ea14..e114cef7 100644
--- a/askbot/models/tag.py
+++ b/askbot/models/tag.py
@@ -97,7 +97,7 @@ class TagQuerySet(models.query.QuerySet):
search query is the most common - just return a list
of top tags"""
cheating = True
- tags = Tag.objects.all().order_by('name')
+ tags = Tag.objects.all().order_by('-used_count')
else:
cheating = False
#getting id's is necessary to avoid hitting a heavy query
@@ -109,7 +109,7 @@ class TagQuerySet(models.query.QuerySet):
).annotate(
local_used_count=models.Count('id')
).order_by(
- 'name'
+ '-local_used_count'
)
if ignored_tag_names:
@@ -117,8 +117,7 @@ class TagQuerySet(models.query.QuerySet):
tags = tags.exclude(deleted = True)
- #tags = tags[:50]#magic number
-
+ tags = tags[:50]#magic number
if cheating:
for tag in tags:
tag.local_used_count = tag.used_count