Я использую версию django 1.11.5 и в моем шаблоне {{ user.is_authenticated }}
печатает CallableBool(False)
или CallableBool(True)
Что смущает мое условие этого шаблона
{% if not user.is_authenticated %}
https://code.djangoproject.com/ticket/26988 Я видел эту проблему на веб-сайте проекта django, и он говорил об обновлении до версии 1.10 django, но моя версия django - 1.11.5
Моя версия python - 3.5, я думаю, что вместо bool значение trueили false я получаю 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