In this video I'll show you how to determine the correct user when editing blog posts.
Right now, anyone who is logged in can edit or delete a blog post. That's no good! We only want the person who created a post to be able to edit or delete it.
So we need to figure out two things:
- who the current logged in user is
- who the author of the post is
Once we know those two things, we can compare the two to determine if the current logged in user is the same as the author. If so, they can edit or delete the post. If not, they can't.
Смотрите видео How To Determine The Correct User To Edit Posts - Django Blog #16 онлайн без регистрации, длительностью 13 минут 30 секунд в хорошем hd качестве. Это видео добавил пользователь Codemy.com 06 Май 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 22 тысяч раз и оно понравилось 74 людям.