title: Django model: Email field unique if not null/blank
body: <p>Let's say you have a simple model: </p>
  
  <pre><code>Class Contact(models.Model):
      email = models.EmailField(max_length=70,blank=True)
      first = models.CharField(max_length=25,blank=True)
      last = models.CharField(max_length=25,blank=True)
  </code></pre>
  
  <p>What I would like to do is set email to be unique, however, in doing so I necessarily make it such that I exclude blank email addresses - and I don't want that.</p>
  
  <p>I was thinking about something like this but I'm wondering if there is a better way to deal with it.</p>
  
  <pre><code>from django.core.validators import email_re
  from django.core.exceptions import ValidationError
  
  def save(self, *args, **kwargs):
      # ... other things not important here
      self.email = self.email.lower().strip() # Hopefully reduces junk to ""
      if self.email != "": # If it's not blank
          if not email_re.match(self.email) # If it's not an email address
              raise ValidationError(u'%s is not an email address, dummy!' % self.email)
          if Contact.objects.filter(email = self.email) # If it already exists
              raise ValidationError(u'%s already exists in database, jerk' % self.email) 
      super(Contact, self).save(*args, **kwargs)
  </code></pre>
  
  <p>Is there a better way to do this? </p>