There may be a performance issue for large object sets and retrieving all tags:
def tag_list(request): all_tags = TaggedItem.objects.order_by('tag') tag_names = {} for tag in all_tags: if tag.tag not in tag_names: tag_names[tag.tag] = tag names = sorted(tag_names.keys()) tag_list = [tag_names[tag] for tag in names] print tag_list return render_to_response('tags/tag_list.html', {'object_list':tag_list}, context_instance = RequestContext(request)) The overhead maybe more than scanning through all objects in a database as multiple tags can be assigned to multiple objects. IIRC, there are potentially two solutions to this. Use 'distinct' in the first query which should remove duplicates at the database server, or have the tags themselves stored in a separate table and marked as unique. In the second case the 'tag' field in TaggedItem would be a foreign key rather than the string tag itself. If this is for something like a blog then it probably won't be a problem. For large data sets, say several thousand users who may be tagged in various ways, it could be a performance issue. Justin plungerman wrote: > greetings, > > i studied long and hard the tagging app from Luke Plant and the one > from the bulletin board app called zyons (http://zyons.com/), and i was > unable to wrap my head around neither. granted i am not the sharpest > tool in the shed, but the docs for Sr. Plant's app are a little > confusing. then again, it is really not his responsibility to provide > it, so no worries there. in the end, i integrated the tagging app that > jay parlar developed for his website. it uses the GenericForeignKey > framework, so you can tag arbitrary objects and manage the tags quite > easily with a little costomisation to the existing code base, which > uses javascript and the django admin. check it out: > > http://svn.jayparlar.com/website/trunk/ > > laters, > > steve > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---