In my base template, I want to include a search form.
I already created it, but I’m wondering if there is a better option than passing the form to all my templates that extend the base?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yea, this is what template context processors are useful for. They allow you to pass a variable to all your templates without having to specify.
settings.py
context_processors.py (you place this in one of your apps, or in the main directory if you prefer)
Now you can use the {{ search_form }} in all of you templates