How To Determine The Correct User To Edit Posts - Django Blog #16

Published: 06 May 2020
on channel: Codemy.com
22K
74

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.



Watch video How To Determine The Correct User To Edit Posts - Django Blog #16 online without registration, duration 13 minute 30 second in high hd quality. This video was added by user Codemy.com 06 May 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 22 thousand once and liked it 74 people.