title: Django: How to enforce UniqueConstraint with parent and child models
body: <p>Say I have the following models:</p>
  <pre class="lang-py prettyprint-override"><code>class ParentModel(models.Model):
      parent_field_1 = models.CharField(max_length=10)
      parent_field_2 = models.CharField(max_length=10)
  
      class Meta:
          constraints = [
              models.UniqueConstraint(
                  fields=['parent_field_1', 'parent_field_2', 'child_field_2'],
                  name='unique_parent_example'
              )
          ] 
  
  class ChildModel(ParentModel):
      child_field_1 = models.CharField(max_length=10)
      child_field_2 = models.CharField(max_length=10)
  </code></pre>
  <p>I want to utilise the <code>ParentModel</code>'s <code>UniqueConstraint</code> but apply an additional field within the <code>ChildModel</code>'s <code>UniqueConstraint</code>. I know this is not possible but to help visualise the idea, I'd ideally like to do something like this:</p>
  <pre class="lang-py prettyprint-override"><code>class ChildModel(ParentModel):
      [.. fields ..]
  
      class Meta:
          constraints = [
              models.UniqueConstraint(
                  fields=['parentmodel', 'child_field_2'],
                  name='unique_child_example'
              )
          ] 
  </code></pre>
  <p>Almost like I'm building the unique constraint as inheritance also.</p>
  <p>How could I do this?</p>