Commits

Anonymous committed 0814adb

Fixed get_recent_posts tag

Comments (0)

Files changed (1)

gnocchi/blog/templatetags/blog.py

         self.tags = tags
         self.username = username
     def render(self, context):
+        count = self.count.resolve(context)
         tags = filter(None, [tag.resolve(context) for tag in self.tags])
         varname = self.varname
         if not isinstance(varname, basestring):
             qset = qset.filter(tag__in=tags)
         if username:
             qset = qset.filter(posted_by__username=username)
-        context[varname] = qset
+        context[varname] = qset[:count]
         return ''
 
 @register.tag
 def get_recent_posts(parser, token):
     args, kwargs, as_name = parse_args(parser, token, 'posts')
-    count = int(args.pop(0))
+    count = args.pop(0)
     return RecentPostsNode(count, as_name, *args, **kwargs)
 
 @register.filter