Invitation: fix the checks making sure you can't invite yourself.

master
Tom Hacohen 4 years ago
parent 9f1bfceda7
commit 41a03e9d3b

@ -294,7 +294,7 @@ class CollectionInvitationSerializer(serializers.ModelSerializer):
def validate_user(self, value): def validate_user(self, value):
request = self.context['request'] request = self.context['request']
if request.user == value.lower(): if request.user.username == value.lower():
raise serializers.ValidationError('Inviting yourself is not allowed') raise serializers.ValidationError('Inviting yourself is not allowed')
return value return value

Loading…
Cancel
Save