title: Django's ModelForm unique_together validation
body: <p>I have a Django model that looks like this.</p>
  
  <pre><code>class Solution(models.Model):
      '''
      Represents a solution to a specific problem.
      '''
      name = models.CharField(max_length=50)
      problem = models.ForeignKey(Problem)
      description = models.TextField(blank=True)
      date = models.DateTimeField(auto_now_add=True)
  
      class Meta:
          unique_together = ("name", "problem")
  </code></pre>
  
  <p>I use a form for adding models that looks like this:</p>
  
  <pre><code>class SolutionForm(forms.ModelForm):
      class Meta:
          model = Solution
          exclude = ['problem']
  </code></pre>
  
  <p>My problem is that the <code>SolutionForm</code> does not validate <code>Solution</code>'s <code>unique_together</code> constraint and thus, it returns an <code>IntegrityError</code> when trying to save the form. I know that I could use <code>validate_unique</code> to manually check for this but I was wondering if there's any way to catch this in the form validation and return a form error automatically.</p>
  
  <p>Thanks.</p>