          # instance representation is set by six.text_type()
          self.assertContains(
              response,
              '<li class="success">The short message "<a href="%s">'
              'ShortMessage_Deferred_timestamp object</a>" was changed successfully.</li>' %
              reverse('admin:admin_views_shortmessage_change', args=(sm.pk,)), html=True
          )
  
      def test_edit_model_modeladmin_only_qs(self):
          # Test for #14529. only() is used in ModelAdmin.get_queryset()
 
</s> remove             'Paper_Deferred_author object</a>" was changed successfully.</li>' %
 </s> add             'Paper object</a>" was changed successfully.</li>' % </s> remove     def test_ticket_11936(self):
        app_config = apps.get_app_config("defer_regress")
        # Regression for #11936 - get_models should not return deferred models
        # by default. Run a couple of defer queries so that app registry must
        # contain some deferred classes. It might contain a lot more classes
        # depending on the order the tests are ran.
        list(Item.objects.defer("name"))
        list(Child.objects.defer("value"))
        klasses = {model.__name__ for model in app_config.get_models()}
        self.assertIn("Child", klasses)
        self.assertIn("Item", klasses)
        self.assertNotIn("Child_Deferred_value", klasses)
        self.assertNotIn("Item_Deferred_name", klasses)
        self.assertFalse(any(k._deferred for k in app_config.get_models()))

        klasses_with_deferred = {model.__name__ for model in app_config.get_models(include_deferred=True)}
        self.assertIn("Child", klasses_with_deferred)
        self.assertIn("Item", klasses_with_deferred)
        self.assertIn("Child_Deferred_value", klasses_with_deferred)
        self.assertIn("Item_Deferred_name", klasses_with_deferred)
        self.assertTrue(any(k._deferred for k in app_config.get_models(include_deferred=True)))

 </s> add  </s> remove             # This slightly odd construct is so that we can access any
            # data-descriptor object (DeferredAttribute) without triggering its
            # __get__ method.
            if (field.attname not in kwargs and
                    (isinstance(self.__class__.__dict__.get(field.attname), DeferredAttribute) or
                        field.column is None)):
                # This field will be populated on request.
 </s> add             # Virtual field
            if field.attname not in kwargs and field.column is None: </s> remove ``field_names`` are in the same order as the ``values``, so it is possible to
use ``cls(**(zip(field_names, values)))`` to instantiate the object. If all
of the model's fields are present, then ``values`` are guaranteed to be in
the order ``__init__()`` expects them. That is, the instance can be created
by ``cls(*values)``. It is possible to check if all fields are present by
consulting ``cls._deferred`` - if ``False``, then all fields have been loaded
from the database.
 </s> add ``field_names`` are in the same order as the ``values``. If all of the model's
fields are present, then ``values`` are guaranteed to be in the order
``__init__()`` expects them. That is, the instance can be created by
``cls(*values)``. If any fields are deferred, they won't appear in
``field_names``. In that case, assign a value of ``django.db.models.DEFERRED``
to each of the missing fields. </s> remove         self.assert_delayed(self.s1.primary_set.all().only('pk')[0], 3)
 </s> add         # The related_id is alawys set even if it's not fetched from the DB,
        # so pk and related_id are not deferred.
        self.assert_delayed(self.s1.primary_set.all().only('pk')[0], 2)
            'ShortMessage object</a>" was changed successfully.</li>' %
          # instance representation is set by six.text_type()
          self.assertContains(
              response,
              '<li class="success">The short message "<a href="%s">'
            'ShortMessage object</a>" was changed successfully.</li>' %
              reverse('admin:admin_views_shortmessage_change', args=(sm.pk,)), html=True
          )
  
      def test_edit_model_modeladmin_only_qs(self):
          # Test for #14529. only() is used in ModelAdmin.get_queryset()
keep keep keep keep replace keep keep keep keep keep
 Fixed #26207 -- Replaced dynamic classes with non-data descriptors for deferred instance loading. 
tests/admin_views/tests.py