开发者

How can I pass a variable to all of my views? (Django)

开发者 https://www.devze.com 2023-01-31 00:04 出处:网络
I need to use the same object in all of my views. Is there a better way to get it in the template than repeating myself in each view. e.g., I need to get Myobj.objects.all() fo开发者_如何学运维r all o

I need to use the same object in all of my views. Is there a better way to get it in the template than repeating myself in each view. e.g., I need to get Myobj.objects.all() fo开发者_如何学运维r all of my views.

Thanks


Sounds like context processors are what you're looking for here.

0

精彩评论

暂无评论...
验证码 换一张
取 消