title: Access Django ManyToMany field values within Model.clean()
body: <p>It seems (though I'm having trouble finding it in the Django documentation) that <code>ManyToMany</code> fields are deferred when they are selected in the Django admin, and so effectively not set, during the call to a Django Model's <a href="https://docs.djangoproject.com/en/2.2/ref/models/instances/#django.db.models.Model.clean" rel="nofollow noreferrer"><code>.clean()</code> method</a>.</p>
  
  <p>Here's an example to illustrate.</p>
  
  <p><strong>models.py</strong>:</p>
  
  <pre><code>import uuid
  from django.core.exceptions import ValidationError
  from django.db import models
  from django.utils.translation import gettext_lazy as _
  
  class Country(models.Model):
      code = models.SlugField(max_length=2, primary_key=True)
      name = models.CharField(max_length=64, db_index=True, unique=True)
  
  class Region(models.Model):
      id = models.UUIDField(default=uuid.uuid4, primary_key=True)
      name = models.CharField(max_length=64, db_index=True, unique=True)
  
  class SampleModel(models.Model):
      id = models.UUIDField(default=uuid.uuid4, primary_key=True)
      regions = models.ManyToManyField(Region, blank=True)
      countries = models.ManyToManyField(Country, blank=True)
      field1 = models.PositiveIntegerField()
      field2 = models.CharField(
          max_length=3,
          choices=[("foo", "FOO"), ("bar", "BAR")]
      )
  
      def clean(self, *args, **kwargs):
          print(
              "Got id=%s, regions=%s, countries=%s, field1=%s, field2=%s"
              % (self.id, self.regions.all(), self.countries.all(), self.field1, self.field2)
          )
          if self.regions.exists() and self.countries.exists():
              raise ValidationError(_("'Regions' and 'Countries' are mutually exclusive"))
          super().clean(*args, **kwargs)
  </code></pre>
  
  <p><strong>admin.py</strong>:</p>
  
  <pre><code>from django.contrib import admin
  from my_app.models import SampleModel
  @admin.register(SampleModel)
  class SampleModleAdmin(admin.ModelAdmin):
      fields = ("regions", "countries", "field1", "field2")
  </code></pre>
  
  <p>In Django shell after <code>./manage makemigrations &amp;&amp; ./manage migrate</code>:</p>
  
  <pre><code>from my_app.models import Country, Region
  
  Country.objects.bulk_create([
      Country(code="US", name="United States"),
      Country(code="UK", name="United Kingdom"),
  ])
  Region.objects.bulk_create([
      Region(name="North America"),
      Region(name="EMEA"),
  ])
  </code></pre>
  
  <p>Above, <code>SampleModel</code> overrides <code>.clean()</code> <strong>to enforce that <code>regions</code> and <code>countries</code> are mutually exclusive.</strong>  (Specify one or the other, but not both.)</p>
  
  <p>From the add page at <code>/admin/my_app/samplemodel/</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/VQ7eT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VQ7eT.png" alt="enter image description here"></a></p>
  
  <p>From the runserver stdout I see (with newlines added):</p>
  
  <pre><code>Got
  id=6340d6bf-3f38-45e6-b431-b56985240e45,
  regions=&lt;QuerySet []&gt;,  # Why is this empty?
  countries=&lt;QuerySet []&gt;,  # Same here
  field1=100,
  field2=bar
  </code></pre>
  
  <p>despite there being selected <code>regions</code> and <code>countries</code> in the model form.</p>
  
  <p><strong>How can I properly access these values within <code>.clean()</code>?</strong></p>