Always including the user in the django template context

前端 未结 8 639
一向
一向 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:18

    There is no need to write a context processor for the user object if you already have the "django.core.context_processors.auth" in TEMPLATE_CONTEXT_PROCESSORS and if you're using RequestContext in your views.

    if you are using django 1.4 or latest the module has been moved to django.contrib.auth.context_processors.auth

提交回复
热议问题