from .models import Thread


def user_messages(request):
    c = {}
    if request.user.is_authenticated():
        c["inbox_count"] = Thread.inbox(request.user).count()
    return c

from .models import Thread


def user_messages(request):
    c = {}
    if request.user.is_authenticated():
        c["inbox_threads"] = Thread.inbox(request.user)
        c["unread_threads"] = Thread.unread(request.user)
    return c

Return querysets in context processor to be more useful
Return querysets in context processor to be more useful

  from .models import Thread
  
  
  def user_messages(request):
      c = {}
      if request.user.is_authenticated():
-         c["inbox_count"] = Thread.inbox(request.user).count()
+         c["inbox_threads"] = Thread.inbox(request.user)
+         c["unread_threads"] = Thread.unread(request.user)
      return c
  
Return querysets in context processor to be more useful
## Code Before:
from .models import Thread


def user_messages(request):
    c = {}
    if request.user.is_authenticated():
        c["inbox_count"] = Thread.inbox(request.user).count()
    return c

## Instruction:
Return querysets in context processor to be more useful
## Code After:
from .models import Thread


def user_messages(request):
    c = {}
    if request.user.is_authenticated():
        c["inbox_threads"] = Thread.inbox(request.user)
        c["unread_threads"] = Thread.unread(request.user)
    return c
