1👍
✅
Using your example:
def get_object(self):
obj = super(BlogListMyAccount,self).get_object()
if obj.author != self.request.user and not self.request.user.is_superuser:
raise PermissionDenied
return obj
Usually this is how you check if the user have admin permissions: request.user.is_superuser
.
References:
Source:stackexchange.com