@login_required
def message_remove(request, object_id, template_name='messages/message_remove_confirm.html'):
 message = get_object_or_404(Message, pk=object_id)
 next = request.GET.get('next', None)
 if (request.method == 'POST'):
  if (message.to_user == request.user):
   message.to_status = TO_STATUS_DELETED
  else:
   message.from_status = FROM_STATUS_DELETED
  message.save()
  return HttpResponseRedirect((next or reverse('messages:messages')))
 return render_to_response(template_name, {'message': message, 'next': next}, context_instance=RequestContext(request))

@ login_required def message_remove ( request , object_id , template_name = 'messages/message_remove_confirm.html' ) : message = get_object_or_404 ( Message , pk = object_id ) next = request . GET . get ( 'next' , None ) if ( request . method == 'POST' ) : if ( message . to_user == request . user ) : message . to_status = TO_STATUS_DELETED else : message . from_status = FROM_STATUS_DELETED message . save ( ) return HttpResponseRedirect ( ( next or reverse ( 'messages:messages' ) ) ) return render_to_response ( template_name , { 'message' : message , 'next' : next } , context_instance = RequestContext ( request ) )
remove a message .