0

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%}
1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by mhangman
0

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>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.