Exemplo n.º 1
0
def send_comment_mail(sender, instance, **kwargs):
    title = '{} 글에 댓글이 달렸습니다'.format(instance.post.title)
    content = '{}에 {}내용이 달렸네요'.format(
        instance.created_date.strftime('%Y.%m.%d %H:%M'), instance.content)
    print('send_comment_mail')
    send_mail(title, content)
    send_sms(content, instance.post.author.phone_number)
Exemplo n.º 2
0
def send_comment_mail(sender, instance, **kwargs):
    content = '{}에 {}내용이 달렸네요'.format(
        instance.created_date.strftime('%Y.%m.%d %H:%M'), instance.content)
    receiver_phone_number = instance.post.author.phone_number
    print(instance.post.author.phone_number)
    print(receiver_phone_number)
    print('send_comment_mail1')
    send_sms(content, receiver_phone_number)
Exemplo n.º 3
0
def send_comment_mail(sender, instance, **kwargs):
    title = '{} 글에 댓글이 달렸습니다'.format(instance.post.title)
    content = '{}에 {}내용이 달렸네요'.format(
        instance.created_date.strftime('%Y.%m.%d %H:%M'),
        instance.content
    )
    print('send_comment_mail')
    send_mail(title, content)
    send_sms(content, instance.post.author.phone_number)
Exemplo n.º 4
0
    def save(self, *args, **kwargs):
        super(Comment, self).save(*args, **kwargs)

        print(self.post.author.email)

        recipient_list = [self.post.author.email]
        send_mail('댓글이 달렸습니다.', '확인해보세요', recipient_list)

        print(self.post.author.phone)

        send_sms(self.post.author.phone, '댓글이 달렸습니다.\n확인해보세요.')
Exemplo n.º 5
0
    def save(self, *args, **kwargs):
        super(Comment, self).save(*args, **kwargs)
        # print(self.post.author.email)
        # recipient_list = [self.post.author.email]
        title = 'A comment on the {} has been posted.'.format(self.post.title)
        content = '{} has been added on {}.'.format(
            self.content, self.created_date.strftime('%Y.%m.%d %H:%M'))
        number = self.post.author.phone_number
        # send_mail('A comment has been posted', 'Please check via Facebook')
        send_mail(title, content)

        send_sms(number, content)
Exemplo n.º 6
0
def wps_detail(request, student_id):
    one_wps = get_object_or_404(MyUser, id=student_id)
    if request.method == 'POST':
        message = request.POST['message']
        if not message:
            message = '졸지 마세요.'

        phonenumber = request.POST['phonenumber']
        sms.send_sms(phonenumber, message)
        messages.success(request, '성공적으로 문자가 발송되었습니다.')
        return redirect('wps:wps_detail', student_id)

    else:
        pass

    return render(request, 'wps/wps_detail.html', {'one_wps': one_wps})
Exemplo n.º 7
0
def send_comment_reaction(sender, instance, **kwargs):
    """
    save 오버라이드 안하고 signal 사용
    :param sender:
    :param instance:
    :param kwargs:
    :return:
    """
    title = '{} 글에 댓글이 달렸습니다'.format(instance.post.title)
    content = '{} 에 {} 내용이 달렷네요'.format(
        # datetime.strftime(format) : 입력된 포맷 형식에 맞추어 datetime 객체를 문자열로 반환
        instance.created_date.strftime('%Y. %m. %d %H:%M'),
        instance.content)
    send_mail(title, content)
    receiver_number = instance.post.author.phone_number
    send_sms(title, receiver_number)
Exemplo n.º 8
0
def wps_list(request):
    context = {}
    all_wps = MyUser.objects.all()
    if request.method == 'POST':
        message = request.POST.get('message')
        if message == '':
            message = '더 조는 것을 과시하지 않겠습니다.'
        # 추후 모두의 번호를 사용하도록 해야 됨.

        all_wps_phonenumbers = ','.join([wps.phonenumber for wps in all_wps])
        sms.send_sms(all_wps_phonenumbers, message)


        sms.send_sms('01024956962', message)
    context['all_wps'] = all_wps

    return render(request, 'wps/wps_list.html', context)