                  raise InvalidQuery("Field %s.%s cannot be both deferred"
                                     " and traversed using select_related"
                                     " at the same time." %
                                     (field.model._meta.object_name, field.name))
              return False
      return True
  
  
  # This function is needed because data descriptors must be defined on a class
  # object, not an instance, to have any effect.
 
</s> remove         # With a depth-based select_related, all deferred ForeignKeys are
        # deferred instead of traversed.
        with self.assertNumQueries(3):
 </s> add         # select_related() overrides defer().
        with self.assertNumQueries(1): </s> remove         with self.assertNumQueries(1):
 </s> add  </s> remove         with self.assertNumQueries(1):
 </s> add         with self.assertNumQueries(0): </s> remove         qs = Parent2.objects.select_related('child1', 'child4').only(
 </s> add         qs = Parent2.objects.select_related('child1', 'child1__child4').only( </s> remove     @unittest.expectedFailure
 </s> add 
                  raise InvalidQuery("Field %s.%s cannot be both deferred"
                                     " and traversed using select_related"
                                     " at the same time." %
                                     (field.model._meta.object_name, field.name))

      return True
  
  
  # This function is needed because data descriptors must be defined on a class
  # object, not an instance, to have any effect.
keep keep keep keep replace keep keep keep keep keep
 Fixed #26486 -- Fixed a select_related() + defer() MTI edge case. 
django/db/models/query_utils.py