def list_objects(request, tag_id, content_object): tag = get_object_or_404(Tag, pk=tag_id) print tag.name if content_object == "0": objects = TaggedItem.objects.filter(tag=tag_id) #title = "List objects tagged with "+tag.name for o in objects: print o.content_object print title else: content_type = get_object_or_404(ContentType, pk=content_object) title = "List "+content_type.name+" tagged with "+tag.name objects = TaggedItem.objects.get(tag=tag_id,content_object=content_object) print objects print title template = loader.get_template('tags/list_objects.html') context = Context({ 'title': "List all Tags", 'objects': object })