I'm building a blog app with multi users and i'd like to have this ability that every logged user could click on every username (post author) and see details of this profile my current function gives me only details for current logged in user no mattew what user i click. i have similar CBV function working for post list view that shows me all the posts for each user and i've tried to do the same but it didn't worked.. Please help ;)
view
> @login_required def profile_detail(request): context = { 'profile': Profile.objects.all() } return render(request, 'users/user_detail.html', context) model
class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(default='default.jpg', upload_to='profile_pics') def __str__(self): return f'{self.user.username} Profile' def save(self, *args,**kwargs): super().save(*args,**kwargs) img = Image.open(self.image.path) if img.height >300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path) url pattern
path('profile-detail/', user_views.profile_detail, name='user_detail'), link
<a class="mr-2" href="{% url 'user_detail' %}">{{ post.author }}</a>
post.authoraProfileor aUser?