Determine Correct User To Edit Posts - Django Blog #16

in #programming4 years ago

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

Sort:  

Congratulations @codemy! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 30000 upvotes. Your next target is to reach 35000 upvotes.

You can view your badges on your board and compare to others on the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @hivebuzz:

Revolution! Revolution!
Vote for us as a witness to get one more badge and upvotes from us with more power!

woohoo!

Cheers to you @codemy! 🙂🥂 Great job!