def unique_email(self, model, instance): if User.objects.filter(email=instance.email): raise autofixture.InvalidConstraint(('email', ))
def unique_email(self, model, instance): if User.objects.filter(email=instance.email).exists(): raise autofixture.InvalidConstraint((get_field(model, 'email'), ))