Updating and Deleting a Comment
Explore how to enable comment updates and deletions in a Django social media app. Learn to restrict editing and deleting permissions to comment authors, post authors, or superusers, and implement validation and permission logic for secure operations.
We'll cover the following...
We'll cover the following...
Updating a comment is an action that can only be done by the author of the comment. And the user should only be able to update the body field of the comment and can’t modify the author value. Let's go over the steps to add the update feature.
In core/comment/viewsets, make sure that put is in the list of http_method_names of CommentViewSet: