from django.template import Library, Node from project.app.models import Tag import random register = Library() maxsize =220 # maximum size of the most popular tag minsize = 55 # minimum size of the least popular tag class LatestTagsNode(Node): def gen_clouds(self): p=Tag.objects.all() max1=max([int(p-item.video_set.count()) for p-item in p]) for i in range(p.count()): size =int(round(int(p[i].video_set.count())*maxsize/max1)) if size