作者sean72 (.)
看板Python
标题[问题] django view and templates
时间Tue Mar 15 07:10:35 2016
tutorial
https://thinkster.io/django-angularjs-tutorial
github
https://github.com/brwr/thinkster-django-angular
在templates/navbar.html里面
他用变数user.is_authenticated 来切换navbar按钮
请问在authentication/view.py 里面
他是如何产生变数 user 并且放在context然後return response?
我隐约觉得这跟django built-in authentication User Class有关联
但是却不清楚template里面的user是怎麽从view.py传出来的
谢谢大家解答
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 204.96.168.3
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1457997041.A.BE8.html
2F:→ Dforce: django.short.render(request,template_name,dictionary) 03/15 08:56
3F:→ uranusjr: 来自 django.contrib.auth.context_processors.auth 03/15 14:58
4F:→ uranusjr: 这个叫 context processor, 详细解释请参照文件 03/15 14:59