Just try out the lines below

if request.user.is_authenticated:
    user = request.user
    if (post.author.username == user):
        # your code here
    else:
        # show yor error that you cannot edit other
        user's post
else:
   return redirect ("/")

On Thu, Apr 7, 2022, 23:14 Kasper Laudrup <laud...@stacktrace.dk> wrote:

> On 07/04/2022 09.57, OG TV wrote:
> > Hello everybody Please kindly help me out for my Django project I try to
> > update the post from the specific admin but even i'm not belong to that
> > post but  i'm still can update that post so the point is I want to allow
> > user can only update the post who belong to that post I meant who own
> > that post .
> >
>
> Reading this would be a good start if you want someone to help you:
>
> https://www.clearvoice.com/blog/how-to-use-punctuation/
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/92e69ee7-9b17-f54c-f30c-aa9dd390228c%40stacktrace.dk
> .
>

-- 
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/CAF7qQgB3RsoE8_a-UWkMcdBfU2UUHEx%3D9bhyKEoU5AkbbGGEYg%40mail.gmail.com.

Reply via email to