mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-22 09:18:13 +00:00
Staff edit commnets
This commit is contained in:
@@ -422,8 +422,11 @@ class CommentSerializer(serializers.HyperlinkedModelSerializer):
|
||||
|
||||
def get_can_edit(self, obj):
|
||||
user = self.context['request'].user
|
||||
if user is not None and obj.user is not None and user.is_authenticated():
|
||||
return user.is_staff or obj.user.id == user.userprofile.id
|
||||
if user is not None:
|
||||
if user.is_staff:
|
||||
return True
|
||||
if obj.user is not None and user.is_authenticated():
|
||||
return obj.user.id == user.userprofile.id
|
||||
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user