breaks in django2

Issue #98 resolved
Anonymous created an issue

When running in django2 get:

context = processor(self.request)
  File postman/", line 8, in inbox
    if request.user.is_authenticated():
TypeError: 'bool' object is not callable

it is because in danjgo2 using User.is_authenticated() and User.is_anonymous() as methods rather than properties is no longer supported. (see

Just removing the brackets solve the problem:

from __future__ import unicode_literals

from postman.models import Message

def inbox(request):
    """Provide the count of unread messages for an authenticated user."""
    if request.user.is_authenticated:
        return {'postman_unread_count': Message.objects.inbox_unread_count(request.user)}
        return {}

Comments (1)

  1. Log in to comment