#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):

 I'm planning on tackling this issue. The initial plan is to:
   - Change ForeignObjectRel subclasses to real field instances. (For
 example, ForeignKey generates a ManyToOneRel in the related model). The
 Rel instances are already returned from get_field(), but they aren't yet
 field subclasses.
   - Allow direct usage of ForeignObjectRel subclasses. In certain cases it
 can be advantageous to be able to define reverse relations directly. For
 example, see https://github.com/akaariai/django-reverse-unique.
   - Partition ForeignKey to virtual relation field, and concrete data
 field. The former is the model.author, the latter model.author_id's
 backing implementation.
   - Consider other cases where true virtual fields are needed.

 My initial try will be a class structure like:
 {{{
     Field
         RelationField (base class for ForeignKey, ManyToOneRel, maybe also
 ManyToManyField)
         ConcreteField (base class for concrete data fields, for example
 IntegerField, ...)
 }}}

 I expect this to cause a good amount of breakage in 3rd party apps. I'm
 going to use the old good "lets first break things, then fix those cases
 that are complained about".

--
Ticket URL: <https://code.djangoproject.com/ticket/16508#comment:5>
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.5ef17b20230f0d1b10ee8363e6e9ca7b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to