I am creating a web app and I want this to display other user's profile through the user's post.
I mean when a user click on other user's profile for see the other user's information then it will show the other user's profile. I've tried everything but it is showing the name of the current user information after click on the post.
Please Help me in this. Thank you very Much. I will really appreciate your Help.
Please help me in this, I don't know where is the problem
What I have tried:
Here is my Code:-
views.py
def post_profile(request,username):
poste = Profile.objects.get(user=request.user)
context = {'poste':poste}
return render(request, 'mains/post_profile.html', context)
models.py
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE,default='',unique=True)
full_name = models.CharField(max_length=100,default='')
date_added = models.DateTimeField(auto_now_add=True)
post_profile.html - ( This is the template of, which will show the other user's profile . )
{% extends "mains/base.html" %}
{% block content %}
{% for topic in poste %}
<a>{{ topic.full_name }}</a><br>
{% empty %}
<li>No informtion.</li>
{% endfor %}
</ul>
{% endblock content %}