My coding is: views
def showThread(request, thread_id) post_list = Post.objects.filter(id = thread_id) post_likes = PostLikes.objects.all() return render_to_response('show.html',locals(),context_instance=RequestContext(request)) models:
class Post(models.Model): subject = models.CharField(max_length = 250) body = models.TextField() thread = models.ForeignKey('self', null = True, editable = False ) Show.html:
{% for post in post_list %} {{post.id}}{{post.subject}} {% endfor %} {% for post_like in post_likes %} {% if post_like.post_id == post.id and post_like.user_id == user.id %} U like this post{{post}} {% else %} {{post}} {% endif %} {% endfor %} In the show.html, else part, it displays the values again and again. But i need only one time.How can i break the for loop when i enter into else condition.Please help me..