Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fish2000/604126 to your computer and use it in GitHub Desktop.
Save fish2000/604126 to your computer and use it in GitHub Desktop.
portype = ContentType.objects.get(model='axitem')
starthue = colors.Color('#585852')
endhue = colors.Color('#FFCB36')
mosttags = cloud = None
if len(Tagg.objects.cloud_for_model(AXItem)) > 0:
mosttags = reduce(lambda ti, to: (float(ti) < float(to)) and float(to) or float(ti),
map(lambda tg: int(tg.items.filter(content_type=portype).count()),
Tagg.objects.cloud_for_model(AXItem)))
cloud = map(lambda tt: (tt[0], starthue.blend(endhue, 0.7-(float(tt[1])/mosttags))),
map(lambda tg: (tg, tg.items.filter(content_type=portype).count()),
Tagg.objects.cloud_for_model(AXItem)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment