Exemple #1
0
def send_message(text="NULL", sender="NULL", addressee="*****@*****.**"):
    """
        发送站内信,text信件正文,sender发件人,addressee收件人,收件人缺省即发送至管理员
    """
    user_message = UserMessage()
    user_message.email = addressee
    user_message.message = "发送人:" + sender + "| 发送信息:" + text
    user_message.save()
    pass
Exemple #2
0
        message_send_form = MessageSendForm(request.POST)
        email = request.POST.get('email', "")
        if message_send_form.is_valid():
<<<<<<< HEAD
            existed_records = UserProfile.objects.filter(email=email)
            if existed_records:
                # new_message = UserMessage()
                # new_message.email = email
                # new_message.message = "发送人:" + request.user.email + "| 发送信息:" + request.POST.get("message", "")
                # new_message.save()
                send_message(request.POST.get("message", ""), request.user.email, email)
=======
            existed_records = UserProfile.objects.filter(email = email)
            if existed_records:
                new_message = UserMessage()
                new_message.email = email
                new_message.message = "发送人:" + request.user.email + "| 发送信息:" + request.POST.get("message", "")
                new_message.save()
>>>>>>> github/master
                return render(request, 'usercenter-sendmessage.html', {"messages": "消息已发送"})
            else:
                return render(request, 'usercenter-sendmessage.html', {"messages": "该用户不存在!"})
        else:
            return render(request, 'usercenter-sendmessage.html', {"message_send_form": message_send_form})


<<<<<<< HEAD
class IndexView(View):
    """
    漏洞体验平台首页
    """