def post_message_to_user(self, msg_text, user,
                             sender=None, msg_type='announcement'):

        max_length = DatedMessage._meta.get_field("msg_text").max_length
        
        if type(user) == User:
            rcvr = user
        else:
            rcvr = User.objects.get(username=user)
            
        m = self.create(msg_text=msg_text[:max_length], type=msg_type, sender=sender)
        m.users.add(rcvr)
send a message to a user
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/messaging/models.py/DatedMessageManager.post_message_to_user