Django Custom Validators Not Working
<p>I wrote a custom validator, which will raise ValidationError if given field value is negative.</p>

<pre><code>  def validate_positive(value):
        if value &lt; 0:
            raise ValidationError(
                    _('%(value) is negative number'),
                    params = {'value': value}
                    )
</code></pre>

<p>i added this to my model field via the field’s validators argument</p>

<pre><code>class Book(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE)
    title = models.CharField(max_length=50)
    price = models.IntegerField(default=0,validators=[validate_positive])
    quantity = models.IntegerField(default=0,validators=[validate_positive])
</code></pre>

<p>But while creating object it's not raising any error if price is less than zero.<br>
I don't know where i am doing wrong and i am new to django. <br>
I am using <strong>Django 1.9</strong>.<br>
Please help me .</p>