How to access the user profile in a Django template?

前端 未结 6 1715
滥情空心
滥情空心 2020-11-30 21:05

I\'m storing some additional per-user information using the AUTH_PROFILE_MODULE.

We can access the user in a Django template using {{ request.user }} bu

6条回答
  •  天涯浪人
    2020-11-30 21:50

    Use {{ request.user.get_profile.whatever }}. Django's templating language automatically calls things that are callable - in this case, the .get_profile() method.

提交回复
热议问题