#27065: Deferred fields not passed to inherited models' __class__.__dict__
----------------------------------------------+----------------------------
     Reporter:  jarekwg                       |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.10
     Severity:  Normal                        |   Keywords:  defer
                                              |  inherited
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+----------------------------
 Possibly a regression, possibly me misunderstanding how this should now
 work in 1.10.

 {{{
 class A(models.Model):
     name = models.CharField(max_length=20)
     addy = models.CharField(max_length=200)


 class B(A):
     name2 = models.CharField(max_length=20)
 }}}


 Calling:
 {{{
 b = B.objects.only('name').first()
 }}}
 we expect `name2` and `addy` to get deferred. Calling
 `b.get_deferred_fields()`, we get both these field names returned as
 expected.

 However, inspecting `b.__class__.__dict__`, we see that only the
 `DeferredAttribute` for `name2` is available. To get the one for `addy`,
 we need to consult `b`'s parent. This was not the case in 1.9.

 See my [https://github.com/carljm/django-model-utils/pull/233 PR] to
 django-model-utils for context.

--
Ticket URL: <https://code.djangoproject.com/ticket/27065>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.96e455f18a24e2a4071e1eeea8e067b6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to