Django: Form in your Site Base template
I need to create a form, not search, but a kind of profile switcher that will be present in the site base.
Just wondering what's the best way of going about this? I'm not very familiar with middlewares but this sounds like the time to investigate it?
Alternatively, I was thinking I could load the form from a templatetag?
I'm just looking for different ways to imple开发者_C百科ment this site wide form. Thanks.
A good example would be Github. The switch account context gives you different pages/accessibility based on your current account context.
Looks like you need context processor
You can write a template including a form, and include this template in your base.html. You have access to the user profile in the template via
{{ request.user.get_profile }}
It this what you need?
精彩评论