Hi,
a while back there has been a discussion about calculated model fields:
https://groups.google.com/g/django-developers/c/ADSuUUuZp3Q/m/5o02Lp_jCwAJ
The main benefit would be that these would be available in cases where
annotations are currently not available, e.g. related queries or admin
lists (see #14336).
Note that the topic of fields that have both a DB and python
implementation was discussed and the consensus was that the python
equivalents could be added by a separate library, if required. So I am
only talking about the database part here.
The linked discussion was mainly about *what* is desired, not *how* it
could be done. I also noticed that the fellows did not participate in
that discussion.
I would like to have a shot at this topic. So I am interested in:
- Do you think this is even possible/worth the effort?
- How could this be implemented and what would be potential challenges?
- Is it possible to implement this in a third party library or does it
require changes to django itself?
I would probably start with a non-editable, non-concrete model field
(similar to GenericForeignKey or ForeignObjRel). But I have no clue yet
how to integrate that with QuerySet/Query.
thanks
tobias