**EXAMPLE** to elaborate my problem -> I am a **user** named **arthor** and i have created many **posts**. when i go to the link **https:example.com/posts/arthor** then i want to see all my posts that i have created. **similarly** if another user name **julia** goes to **https:example.com/posts/julia** then she should see her posts that she created **but** if she goes to **https:example.com/posts/arthor** then she should see the **arthor** i.e my posts only.

**ISSUE** i am facing -> i have created somewhat correct views but in the **get\_queryset** i have **postlist** which takes **myposts** and **filter** them. In the **filter** at the place of **uploaded\_by** i have given **self.request.user.profile** which gives the current user not the user of the link that i being entered in the url. such as if url **https:example.com/posts/arthor** is **triggered** then i want **uploaded\_by=arthor**

urls.py

```
urlpatterns = [
    path("posts/<str:username>", views.UserPostList.as_view(), name="posts"),
]

```

models.py

```
class MyPost(models.Model):
pic = models.ImageField(
    upload_to="users/post_images/%y/%m/%d",
    null=True
)
subject = models.CharField(max_length=200)
message = models.TextField(null=True, blank=True)
created_at = models.DateTimeField(auto_now=True)
uploaded_by = models.ForeignKey(to=Profile, on_delete=CASCADE, null=True)

def __str__(self):
    return "%s" % self.subject

```

views.py

```
class UserPostList(LoginRequiredMixin, SelectRelatedMixin, generic.ListView):
login_url = "accounts:signin"
raise_exception = False

model = models.MyPost
select_related = ('uploaded_by',)
context_object_name = 'myposts'
template_name = 'posts/user_post_list.html'

def get_queryset(self):
    si = self.request.GET.get("si")
    if si == None:
        si = ""
    postList = MyPost.objects.filter(Q(
        uploaded_by=self.request.user.profile)).filter(Q(subject__icontains=si)|Q(message__icontains=si)).order_by("-id");

    for p1 in postList:
        p1.liked = False
        ob = PostLike.objects.filter(post=p1, Liked_by=self.request.user.profile.user)
        if ob:
            p1.liked = True
    return postList

```