def validate_name self attrs source if attrs source qwe pass return at

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def validate_name(self, attrs, source):
if attrs[source] == 'qwe':
pass
return attrs
def validate_name(self, value):
if value == 'qwe':
pass
return value
def validate(self, attrs):
raise serializers.ValidationError({'my_field': 'A field error'})