#16508: Provide real support for virtual fields
-------------------------------------+-------------------------------------
     Reporter:  vzima                |                    Owner:  pirosb3
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by koniiiik):

 Heh, this is skipping a bit further ahead; I would prefer to finish the
 work on `ForeignKey` before moving on to `CompositeField`, and
 `ForeignKey` itself will take quite some time. However, since you have
 already brought it up...

 As far as I recall, I implemented `CompositeField` as a descriptor that
 dynamically constructed a `CompositeValue` on read, and unpacked any tuple
 / iterable into individual values on write, but that was it; the
 `CompositeValue` itself was just a namedtuple, so it didn't act as a proxy
 for the value on the model instance itself. So in your example,
 `u1.full_name.first_name` would be a read-only item.

 I think that is a reasonable restriction; trying to turn a composite value
 into some kind of proxy object might be a fun exercise, but it would
 require some amount of descriptor hacking, and I honestly don't see enough
 value in it that would make it worth the complexity.

--
Ticket URL: <https://code.djangoproject.com/ticket/16508#comment:12>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.c424317a51c7bb6e2a7cc0f5ccbd268f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to