Example #1
0
 def will_create(self, attrs: dict):
     invalid_if(
         len(attrs['somestring']) > 5, 'somestring', 'too long')
Example #2
0
 def base(self, attrs: dict):
     invalid_if(
         len(attrs['somestring']) > 5, 'somestring', 'too long')
Example #3
0
 def will_create(self, attrs: dict):
     invalid_if(self.model.objects.count(), '', '')
Example #4
0
 def check_something(self, attrs):
     invalid_if('d' in attrs['field_1'], 'field_1', 'Boom')
Example #5
0
 def field_field_1(self, value):
     invalid_if('c' in value, 'field_1', 'Boom')
Example #6
0
 def to_representation(self, repr_attrs, validated_attrs: dict = None):
     repr_attrs['extra'] = 'this is an extra'
     invalid_if(repr_attrs['id'] == 2, 'error', 'msg')