Skip to content

Commit

Permalink
allow user to delete own post & thread
Browse files Browse the repository at this point in the history
  • Loading branch information
endiliey committed May 7, 2018
1 parent de0f2b7 commit 404e0d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/posts/api/views.py
Expand Up @@ -40,7 +40,7 @@ class PostDeleteAPIView(generics.DestroyAPIView):
# because if user keep on deleting post doesn't make sense
queryset = Post.objects.all()
serializer_class = PostDeleteSerializer
permission_classes = [IsAdminUser]
permission_classes = [IsOwnerOrAdminOrReadOnly]

def delete(self, request, pk, format=None):
try:
Expand Down
2 changes: 1 addition & 1 deletion backend/threads/api/permissions.py
Expand Up @@ -17,4 +17,4 @@ def has_object_permission(self, request, view, obj):
return True

# Write permissions are only allowed to the user itself
return obj == request.user
return obj.creator == request.user

0 comments on commit 404e0d6

Please sign in to comment.