Esempio n. 1
0
def notify_topic_subscribers(post):
    from apps.jsjtbb.models import Post

    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        for user in topic.subscribers.all():
            if user != post.user:
                subject = u'RE: %s' % topic.name
                to_email = user.email
                text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
                        'username': post.user.username,
                        'message': post_body_text,
                        'post_url': absolute_url(post.get_absolute_url()),
                        'unsubscribe_url': absolute_url(reverse('jsjtbb:forum_delete_subscription', args=[post.topic.id])),
                    }
                #html_content = html_version(post)
                send_mail([to_email], subject, text_content)
Esempio n. 2
0
def notify_pm_recipients(pm):
    if not pm.read:
        from apps.jsjtbb.models import PrivateMessage 
        subject = (u'There are new messages')
        to_email = pm.dst_user.email
        text_content = PM_RECIPIENT_TEXT_TEMPLATE % {
            'username': pm.src_user.username,
            'message': pm.body_text,
            'pm_url': absolute_url(pm.get_absolute_url()),
         }
        send_mail([to_email], subject, text_content)
Esempio n. 3
0
def notify_pm_recipients(pm):
    if not pm.read:
        from apps.jsjtbb.models import PrivateMessage
        subject = (u'There are new messages')
        to_email = pm.dst_user.email
        text_content = PM_RECIPIENT_TEXT_TEMPLATE % {
            'username': pm.src_user.username,
            'message': pm.body_text,
            'pm_url': absolute_url(pm.get_absolute_url()),
        }
        send_mail([to_email], subject, text_content)
Esempio n. 4
0
def notify_topic_subscribers(post):
    from apps.jsjtbb.models import Post

    topic = post.topic
    post_body_text = strip_tags(post.body_html)
    if post != topic.head:
        for user in topic.subscribers.all():
            if user != post.user:
                subject = u'RE: %s' % topic.name
                to_email = user.email
                text_content = TOPIC_SUBSCRIPTION_TEXT_TEMPLATE % {
                    'username':
                    post.user.username,
                    'message':
                    post_body_text,
                    'post_url':
                    absolute_url(post.get_absolute_url()),
                    'unsubscribe_url':
                    absolute_url(
                        reverse('jsjtbb:forum_delete_subscription',
                                args=[post.topic.id])),
                }
                #html_content = html_version(post)
                send_mail([to_email], subject, text_content)