Beispiel #1
0
def send_comment_mail(instance, sender=Comment, **kwargs):
    title = '{} 글에 댓글이 달렸습니다.'.format(instance.post.title)
    content = '{}에 {} 내용이 달렸네요.'.format(
        instance.created_date.strftime('%Y.%m.%d %H:%M'),
        instance.content,
    )
    send_mail(title, content)
Beispiel #2
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)
Beispiel #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)
Beispiel #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확인해보세요.')
Beispiel #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)
Beispiel #6
0
    def create(self, request, *args, **kwargs):
        serializer = self.get_serializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        user = serializer.save()
        content = request.META[
            'HTTP_HOST'] + "/member/email_verify/" + user.get_email_verify_hash(
            ) + "/?email=" + user.email
        send_mail("email verifying", content, (user.email, ))
        Token.objects.get_or_create(user=user)

        return Response(TokenSerializer(user.auth_token).data,
                        status=status.HTTP_200_OK)
Beispiel #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)