Why do I face this problem? I am trying to get the tags from the Post table.Post and tags are two tables with Many to Many relation.
in models.py
class Tag(models.Model):
caption = models.CharField(max_length=40)
class Post(models.Model):
tags = models.ManyToManyField(Tag)
in views
def post_details(request,slug):
post = Post.objects.get(slug=slug)
tags = Post.objects.filter(tags)
comment = post.comments.all()
return render (request,'mblog/post_detail.html',{'post': post ,'tags': tags,'comment': comment})