Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Forked from Ell/gist:918183
Created April 13, 2011 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbranyen/918191 to your computer and use it in GitHub Desktop.
Save tbranyen/918191 to your computer and use it in GitHub Desktop.
if request.method == 'GET':
id = request.GET['id']
tagging = Images.objects.get(id=id)
tags = Tag.objects.usage_for_model(tagging, counts=True)
usageNum = [{"tag": tagfreq.name, "count": tagfreq.count} for tagfreq in tags]
dump = simplejson.dumps(usageNum)
message = dump
$.getJSON('/tags/',
{
id: {{ image.id }},
},
function(data) {
console.log(data);
$("#tagcloud").tagCloud(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment