title: How to check that Django model instance have preselected related data
body: <p>Before Django 2.X I use this function for checking that <code>ForeignKey</code> and <code>OneToOneField</code> were prefetched to the Django model instance.</p>
  
  <pre><code>def ensure_related(obj, field):
      field_obj = obj._meta.get_field(field)
  
      if hasattr(obj, field_obj.get_cache_name()):
          return True
      return False
  </code></pre>
  
  <p>So for example </p>
  
  <pre><code>In [1]: permission = Permission.objects.last()
  
  SELECT "auth_permission"."id",
         "auth_permission"."name",
         "auth_permission"."content_type_id",
         "auth_permission"."codename"
    FROM "auth_permission"
   INNER JOIN "django_content_type"
      ON ("auth_permission"."content_type_id" = "django_content_type"."id")
   ORDER BY "django_content_type"."app_label" DESC,
            "django_content_type"."model" DESC,
            "auth_permission"."codename" DESC
   LIMIT 1
  
  
  In [2]: ensure_related(permission, 'content_type')
  
  Out[2]: False
  
  In [3]: permission = Permission.objects.prefetch_related('content_type').last()
  
  SELECT "auth_permission"."id",
         "auth_permission"."name",
         "auth_permission"."content_type_id",
         "auth_permission"."codename"
    FROM "auth_permission"
   INNER JOIN "django_content_type"
      ON ("auth_permission"."content_type_id" = "django_content_type"."id")
   ORDER BY "django_content_type"."app_label" DESC,
            "django_content_type"."model" DESC,
            "auth_permission"."codename" DESC
   LIMIT 1
  
  
  SELECT "django_content_type"."id",
         "django_content_type"."app_label",
         "django_content_type"."model"
    FROM "django_content_type"
   WHERE "django_content_type"."id" IN (1)
  
  
  In [3]: ensure_related(permission, 'content_type')
  
  Out[4]: True
  </code></pre>
  
  <p>But since Django 2.X this method always return <code>True</code>.</p>
  
  <p>My questions is: how since Django 2.X implement this check?</p>