title: Django catch unique_together in Form and don't save file
body: <p>I have </p>
  
  <pre><code>class Document(models.Model):
      profile = models.ForeignKey(Profile, null=True)
  
      hash = models.CharField(max_length=100, blank=True)
      name = models.CharField(max_length=100, blank=True)
      url = models.CharField(max_length=100, blank=True)
  
      file = models.FileField()
  
      def __str__(self):
          return str(self.id)
  
      @property
      def gen_url(self):
          self.url = uuid.uuid4().hex
  
      @staticmethod
      def gen_digest(file):
          m = hashlib.md5()
          for chunk in read_by_chunk(file):
              m.update(chunk)
          digest = m.hexdigest()
          return digest
  
      class Meta:
          unique_together = (('profile', 'hash'),)
  </code></pre>
  
  <p>When I try to create document with the same <code>profile</code> and <code>document</code> via admin, it returns an error through <code>Form</code>. It's a proper way I want reach in my view.</p>
  
  <p>But:</p>
  
  <pre><code>if form.is_valid():
  
      print 'valid'
      try:
          form.save()
      except IntegrityError:
          print 'unique error'
          messages.add_message(request, messages.ERROR, u'already have')
      return HttpResponseRedirect('/')
  else:
      return HttpResponse('not valid')
  </code></pre>
  
  <p>fails in error.</p>
  
  <p>So questions:</p>
  
  <p>1) How can I show <code>messages</code> rather that failing <code>IntegrityError</code></p>
  
  <p>2) How can I prevent <code>file</code> being created in storage</p>