Add template context processors.#1904
Conversation
|
What's the motivation for it? You can still perform an analogous logic without introducing the |
|
Yes, by copypasting. If you share variables with all templates (for example, teams in sidebar, account balance, etc) you have to generate and pass these variables to the template in every view. Context processors solve this problem. You define login in one place and template's context get automatically updated. |
Kludex
left a comment
There was a problem hiding this comment.
Flask has it: https://flask.palletsprojects.com/en/2.2.x/templating/#context-processors
Django has it: https://docs.djangoproject.com/en/4.1/ref/templates/api/#built-in-template-context-processors
Let's solve the documentation, and I'm fine with this. 👍
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Kludex
left a comment
There was a problem hiding this comment.
I wrote a suggestion to simplify a bit the test, and the documentation.
Everything cool here. 👍
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
|
Are you waiting for anything from my side, @Kludex ? |
|
I was kind a waiting for you to press merge 👀 |
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This PR adds template context processors.
Async processors are not supported.