我正在使用django 1.11.5版本,并且我的模板{{ user.is_authenticated }}
中正在打印CallableBool(False)
或CallableBool(True)
哪个让我的模板条件感到困惑
{% if not user.is_authenticated %}
https://code.djangoproject.com/ticket/26988我已经在django项目网站上看到此问题,并说要升级到django版本1.10,但我的django版本是1.11.5
我的python版本是3.5
我认为我得到的不是CallableBool类型,而是混淆我的情况user.is_authenticated
views.py
class LandingView(TemplateView):
template_name = "website/landing.html"
def get_context_data(self, **kwargs):
context = super(LandingView, self).get_context_data(**kwargs)
print(User)
church_id = self.request.session.get('church_id', None)
print(church_id)
if church_id:
samples = ObituarySample.objects.filter(organization__id=church_id)
context['obituary_samples'] = samples
recent_obituaries = Obituary.objects.filter(organization__id=church_id).order_by("-id")[:3]
context['recent_obituaries'] = recent_obituaries
context['church_cover'] = self.request.session.get('church_cover', None)
return context