To make a user post visible only to that user i.e only to that same user
that post it you do

1.   {% if post.author == user %}
             My html post code

2.   {% if post.author == user.id %}
                My html post code


if ur post class use many to many field for author use no 1 else if u put
in user.id for author use no 2 else just show ur post class model

On Wed, Mar 1, 2023, 13:48 ALBERT ASHABA AHEEBWA <
ashabaaheebwaalb...@gmail.com> wrote:

> If user.is_authenticated
>
>
>
>
>
> On Wed, 1 Mar 2023, 15:45 Ikrombek, <ikromde...@gmail.com> wrote:
>
>> How to make a user's post visible only to that user using Django
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4e825c08-b0d6-4104-8d4c-3b1e09fe851cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4e825c08-b0d6-4104-8d4c-3b1e09fe851cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAQecPcrb75rS_A%3DMZTqZBAUqTtVLnAxTxpAo%3DGLihPmfEhKiw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAQecPcrb75rS_A%3DMZTqZBAUqTtVLnAxTxpAo%3DGLihPmfEhKiw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

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

Reply via email to