Hi

Please don't use this post for support. See
https://docs.djangoproject.com/en/3.1/faq/help/

Thanks,

Adam

On Sun, 3 Jan 2021 at 16:38, AMINE ART <amine.ghandi.am...@gmail.com> wrote:

> Can get you every post if you fill it
> I comment it to get only the user posts
>
> class UserPostsListView(ListView):
> model = Post
> template_name = 'posts/pages/index.html'
> context_object_name = 'posts'
> #That line can ruine everything
> #ordering = ['-date_posted']
> paginate_by = 1
>
> def get_query_set(self):
>     username = self.kwargs.get('username')
>    user = get_object_or_404( User.objects.get(User, username=username) )
>    return Post.objects.filter(author=user).ordered_by('-date_posted')
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/4ab6c581-360a-4588-b1df-58398168afb6n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/4ab6c581-360a-4588-b1df-58398168afb6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM0%3DGkFL454aLZvJ8_cwnDqvwYjehTYKqX6BWix4jnnNuw%40mail.gmail.com.

Reply via email to