title: Django model pre_save Validation in Admin
body: <p>Following is my model:</p>
  
  <pre><code>class Product(models.Model):
      product_title = models.CharField(max_length=100, null=False, 
  verbose_name='Product title')
      product_description = models.TextField(max_length=250, 
  verbose_name='Product description')
      product_qty = models.IntegerField(verbose_name='Quantity')
      product_mrp = models.FloatField(verbose_name='Maximum retail price')
      product_offer_price = models.FloatField(verbose_name='Selling price')
  
  def validate_produce_offer_price(sender, instance, **kwargs):
      if instance.product_offer_price &gt; instance.product_mrp:
          from django.core.exceptions import ValidationError
          raise ValidationError('Product offer price cannot be greater than 
  Product MRP.')
  
  
  pre_save.connect(validate_produce_offer_price, sender=Product)
  </code></pre>
  
  <p>I am trying to validate the <strong>product_offer_price</strong> before the model is saved. The Validation error is being raised successfully, but the on an exception page created by the debugger. How to show the error on the form in the admin itself like other errors raised by the admin form?</p>
  
  <p><a href="https://i.stack.imgur.com/n50Rn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n50Rn.png" alt="exception raised during changing the existing data"></a>
  <a href="https://i.stack.imgur.com/Wzpa9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wzpa9.png" alt="Exception raised while adding new data"></a></p>