Help with implementing calculated fields (#28822)

2021-03-14 Thread Tobias Bengfort
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

Separate context and rendering in forms

2021-03-14 Thread dy...@dyve.net
I've been working on packages that generate HTML based on Django forms for a while. I find myself duplicating certain parts of Django code, because there is no clear separation of the context (as in template context) that is being generated, and the HTML output. A small example of this is the code

Re: Help with implementing calculated fields (#28822)

2021-03-14 Thread schinckel
Hi Tobias. I've done a bit of stuff on this, and found there were actually limited changes that need to be made to django to got this to work. https://schinckel.net/2020/09/15/django-properties-from-expressions%2C-or-computedfield-part-2/ I haven't touched it much since then (although I'm keen