I'm working on an project that let users create blogs and allow other users to comment on each other blogs.When a user creates a blog , their are certain ability that the blog owner can do such as deleting their own comments and the way I'm deleting comments is via hyperlink passing value id . Everyone can see each other blogs but I want to only show the deletion hyperlink to the owner of the blog , so only the user who created the blog. How can I do this? via template
My models
class Blog(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
description = models.TextField()
def Bloglook(request ,animal_id):
Blog = Blog.objects.get(pk=animal_id)
return render(request,'blog.html',{blog':blog})
my blog.html
{% if blog %}
{{blog.name%}}
{% endif %}
How Can I only show this link to the person who created the blog?
<a href="{% url world:BlogDelete blog.id %}"> Delete blog</a>