(request)
return render(request, "message_list.html", context)
Show messages belonging to user.
Show messages belonging to user.
Show messages belonging to user .
def message_list(request):
    """
    Show messages belonging to user.
    """
    user = request.user
    page = request.GET.get("page", 1)
    msgs = Message.objects.filter(recipient=user)
    msgs = msgs.select_related("sender", "body", "sender__profile")
    msgs = msgs.order_by("-sent_date")

    # Get the pagination info
    paginator = Paginator(msgs, settings.MESSAGES_PER_PAGE)
    msgs = paginator.get_page(page)

    context = dict(tab="messages", all_messages=msgs)
    return render(request, "message_list.html", context)
def message_list ( request ) : user = request . user page = request . GET . get ( "page" , 1 ) msgs = Message . objects . filter ( recipient = user ) msgs = msgs . select_related ( "sender" , "body" , "sender__profile" ) msgs = msgs . order_by ( "-sent_date" ) # Get the pagination info paginator = Paginator ( msgs , settings . MESSAGES_PER_PAGE ) msgs = paginator . get_page ( page ) context = dict ( tab = "messages" , all_messages = msgs ) return render ( request , "message_list.html" , context )