#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 akaariai):
Big +1 to introducing these changes in smaller chunks.
For composite fields we are going to have a design problem for mutable
composite values. For example, assume User.full_name is a FullName
instance. What should happen in the following cases, and how to implement
the wanted behavior?
{{{
u = User()
u.full_name = FullName('Anssi', 'Kääriäinen')
u.full_name.first_name = 'Matti'
u.first_name == u.full_name.first_name
OUT: ???
u1 = User()
u2 = User()
u1.full_name = FullName('Anssi', 'Kääriäinen')
u2.full_name = u1.full_name
u2.full_name.first_name = 'Matti'
u1.first_name == u2.first_name
OUT: ???
}}}
This is a nasty issue, and I think we should avoid it by saying that for
now Django doesn't support mutable composite field values (that is, the
composite field's value should be a tuple). Later on we can then decide
how to tackle this issue properly.
--
Ticket URL: <https://code.djangoproject.com/ticket/16508#comment:11>
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/063.f84091ca9f4d38dcc0102ce1f93c89c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.