]> git.0d.be Git - panikweb.git/blobdiff - panikweb/paniktags/templatetags/paniktags.py
add helper tag to get a random selection of emissions
[panikweb.git] / panikweb / paniktags / templatetags / paniktags.py
index 58be364f4d8eb217f124d1e54eaf3f0050c14eea..7ab2c37c094e8649c5a63e6f493bfa36632cab47 100644 (file)
@@ -362,6 +362,11 @@ def related_objects(object):
     return {'more_like_this': sqs.more_like_this(object)[:12]}
 
 
+@register.simple_tag
+def random_emissions(count=6):
+    return Emission.objects.filter(archived=False).order_by('?')[:count]
+
+
 @register.inclusion_tag('includes/topik.html', takes_context=True)
 def topik(context, topik):
     return {'page': topik}