J
J
jorashepel2020-09-14 19:36:17
Django
jorashepel, 2020-09-14 19:36:17

Limited number of posts for non-authorized users?

An unauthorized user can open the main page and only see the 10 most recent blog posts.
when authorized, it can naturally see all posts,
please tell me how it can be implemented in Django
, I already thought how to do it , it
can be done through filters in Html templates,
but I didn’t come up with
help pliz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-09-14
@jorashepel

Easily. You get in the view of the current user, if it is anonymous, then you make a slice of the queryset, if not, then you don't.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question