Exemple #1
0
 def get_has_voted(self, obj):
     return Vote.has_voted(self.context['request'].user, obj)
Exemple #2
0
    def validate(self, data):
        data['voter'] = self.context['request'].user
        if Vote.has_voted(data['voter'], data['project']):
            raise exceptions.ValidationError('You already voted.')

        return data
Exemple #3
0
    def validate(self, data):
        if Vote.has_voted(data['voter'], data['project']):
            raise exceptions.ValidationError('You already voted')

        return data
Exemple #4
0
 def get_has_voted(self, obj):
     return Vote.has_voted(self.context['request'].user, obj)