from django.template import RequestContext from django.shortcuts import render_to_response, get_list_or_404 from jayparlar.tags.models import TaggedItem def tag_detail(request,slug): matching_tags = get_list_or_404(TaggedItem,tag=slug) print "MATCHING", matching_tags object_list = [tag.content_object for tag in matching_tags if tag.content_object] print object_list return render_to_response('tags/tag_detail.html', {'object_list':object_list, 'name':slug}, context_instance=RequestContext(request)) 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))