Hi all,
Im trying to add tags to my blog post. i did it its done but i wanted more so when users click the link of tag, they will see other post tagged same. anyway

here my view_tag function

def view_tag(request, tag_id):
	tag = Tag.objects.get(pk=tag_id)
	news = tag.pnews_set.all()
	return render_to_response("tags.html", {"tag_id":tag_id, "news":news, "tag":tag})

my problem is i cant load any value at the template i saw at example he just write

{{news.name}}

and saw the result but i can.
when i write

{{tag.pnews_set.all}}

i can see these

[<pnews: Sitemiz Test Yayınında>, <pnews: Deneme Yazısı>]

but i want to use something like this:

{%for pnews in news%}
{{pnews.name}}
{%endfor%}

here the answer the problem was pnews.name usage i didnt need that

ul>
{%for pnews in news%}
<li><a href="{%url gmsdetails pnews.id%}"><p>{{pnews}}</p></a></li>
{%endfor%}
</ul>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.