Hi guys!
I'm using django-tagging for my blog and I want to use it
to display a tag cloud. It's easy to get a cloud for a
particular model, but I need a tagcloud for *every* item
I tagged with django-tagging. But I have no idea on how
to do this easily since a Tag has no count attribute in
the first place.
-------
Example:
>>> from django_tagging.models import Tag
>>> from django_tagging.utils import calculate_cloud
>>> all_tag = Tag.objects.all()
>>> calculate_cloud(all_tags)
118 if len(tags) > 0:
119 thresholds = []
--> 120 counts = [tag.count for tag in tags]
121 max_weight = float(max(counts))
122 min_weight = float(min(counts))
<type 'exceptions.AttributeError'>: 'Tag' object has no attribute 'count'
-------
The only possibility to (automatically) get an Tag list
with count attributes is to use usage_for_*model* but
I would need usage_for_tagged_items instead. Someone
an idea how to work around this problem?
(I could fetch all tags with usage_for_model() to get the count added
to the tags and sum them if they're already in the list. But there should
be a much better way. At least, I hope so. :-)
Thanks for your time!
Kai
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---