Determine Correct User To Edit Posts - Django Blog #16

Words
149
Reading
1 min
Listen
Play
6y

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 The Entire Django Blog Playlist
https://bit.ly/3bWN6wj

✅ Subscribe To My YouTube Channel:
http://bit.ly/2IGzvOR

▶️ See More At:
https://Codemy.com

✅ Join My Facebook Group:
http://bit.ly/2GFmOBz

▶️ Learn to Code at https://Codemy.com
Take $22 off with coupon code: youtube

✅ Buy a Codemy T-Shirt!
http://bit.ly/2VC9WUN

Determine Correct User To Edit Posts - Django Blog #16 | Ecency