django-email-notification 允许后台用户向django注册用户或仅知道电子邮件的用户发送简短的邮件通知,告知他们从django的管理界面或专用视图中有什么新变化。然后可以跟踪他们的点击情况。
项目描述
通知是Facebook或Twitter发送给用户的简短电子邮件,告知用户一些更改。
django-email-notification 允许后台用户向django注册用户或仅知道电子邮件的用户发送简短的邮件通知,告知他们从django的管理界面或专用视图中有什么新变化。然后可以跟踪他们的点击情况。
安装
pip install django-email-notification
设置
NOTIFICATION_TEMPLATE = 'email' # name of the templates to use (without extension). Must have a .txt and a .html version NOTIFICATION_FROM_EMAIL = '' # sender email, typically no-reply@you-site.com NOTIFICATION_FROM_NAME = '' # sender name NOTIFICATION_UNSUBSCRIBE_REDIRECT = '/you-unsubscribed/' # possible page redirection after unsubscription NOTIFICATION_REGISTRATION_MESSAGE_TAG = 'notification' # allow filtering notification messages # Description of linkable objects. NOTIFICATION_ASSOCIATED_OBJECTS = ( { 'name': 'products', # reference name, used in forms and templates 'description': u"New products", # Human readable description 'long_description': u"Last products added to our site", # Long description 'class': 'project.application.models.Product', # path to the class model 'title_attr': 'product_description', # Model instance field or callable to display in form 'order_by': '-creation_date', # order to sort Model instances in form and email template 'manager': '', # manager to use if so }, )
电子邮件模板
在模板中,可以通过以下方式处理链接对象,例如
{% if object_types.OBJECT_NAME.instances %} <ul><li>{{ object_types.OBJECT_NAME.long_description }} <ul>{% for instance in object_types.OBJECT_NAME.instances %} <li>{% include 'notification/emails/tracked_link.html' %}</li> {% endfor %}</ul> </li></ul> {% endif %}
通过django消息框架发送的消息按以下方式过滤
{% if messages %} {% for message in messages %} {% if 'notification' in message.tags %} <span class="email-registration-message lvl-{{ message.level }}">{{ message }}</span> {% endif %} {% endfor %} {% endif %}
项目详情
下载文件
为您的平台下载文件。如果您不确定要选择哪个,请了解更多关于 安装软件包 的信息。
源分发
django-email-notification-1.3.tar.gz (14.8 kB 查看哈希值)