@login_required
def message_detail(request, object_id, mailbox=None, template_name='messages/message_detail.html'):
 message = get_object_or_404(Message, pk=object_id)
 content_type = ContentType.objects.get_for_model(message)
 thread_list = Message.objects.filter(object_id=message.object.pk, content_type=content_type).order_by('id')
 message_list = _get_messages(request.user, mailbox)
 if (message.to_user == request.user):
  message.to_status = TO_STATUS_READ
  message.save()
 return render_to_response(template_name, {'message': message, 'thread_list': thread_list, 'message_list': message_list}, context_instance=RequestContext(request))

@ login_required def message_detail ( request , object_id , mailbox = None , template_name = 'messages/message_detail.html' ) : message = get_object_or_404 ( Message , pk = object_id ) content_type = ContentType . objects . get_for_model ( message ) thread_list = Message . objects . filter ( object_id = message . object . pk , content_type = content_type ) . order_by ( 'id' ) message_list = _get_messages ( request . user , mailbox ) if ( message . to_user == request . user ) : message . to_status = TO_STATUS_READ message . save ( ) return render_to_response ( template_name , { 'message' : message , 'thread_list' : thread_list , 'message_list' : message_list } , context_instance = RequestContext ( request ) )
returns a message detail page .