Always including the user in the django template context

前端 未结 8 633
一向
一向 2020-12-04 14:22

I am working on a small intranet site for a small company, where user should be able to post. I have imagined a very simple authentication mechanism where people just enter

8条回答
  •  眼角桃花
    2020-12-04 15:03

    @Dave To use {{user.username}} in my templates, I will then have to use requestcontext rather than just a normal map/hash: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext

    So I guess there are no globals that the template engine checks.

    But the RequestContext has some prepopulate classes that I can look into to solve my problems. Thanks.

提交回复
热议问题