def is_moderator request comments user request user for comment in com

1
2
3
4
5
6
7
8
def is_moderator(request, comments):
user = request.user
for comment in comments:
if comment.user == user or comment.code.user == user or user.is_staff:
setattr(comment, 'is_moderator', True)
return comments