Commits

Anonymous committed fce9167

Added most_common template tag
Fixed typo

  • Participants
  • Parent commits 6120dc6

Comments (0)

Files changed (1)

gnocchi/blog/templatetags/blog.py

 
 @register.assignment_tag
 def get_recent_posts(count, username=None, *tags, **kwargs):
-    tags = filter(None, tags)
     qset = Post.objects.current()
-    for tag in tags:
+    for tag in filter(None, tags):
         qset = qset.filter(tags__name=tag)
     if username:
-        qset = qset.filter(posted_bt__username=username)
-    return qset
+        qset = qset.filter(posted_by__username=username)
+    return qset[:count]
 
 @register.filter
 def recent_posts(value, username=None):
         return qset[:int(value)]
     except Post.DoesNotExist:
         return []
+
+@register.assignment_tag(name='most_common')
+def blog_common_tags():
+    return Post.tags.most_common()
+