-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add template context processors. #1904
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.