Django WordPress的非WordPress扩展集合(真实的)
the-real-django-wordpress-extras的Python项目详细描述
一组有用的非wordpress扩展 Django WordPress(真正的那个)。
pip install the-real-django-wordpress-extras
将wordpressext添加到settings.py中已安装的应用程序。
请务必将wordpressext放在url中wordpress上方。py:
urlpatterns += patterns('', ... url(r'^blog/', include('wordpressext.urls')), url(r'^blog/', include('wordpress.urls')), ... )
电子邮件发件人按以下顺序确定:
- settings.WPEXT_SENDER email address
- settings.POSTMARK_SENDER if Postmark settings are configured and WPEXT_SENDER does not exist
- settings.ADMINS the first admin email address, if POSTMARK_SENDER does not exist
功能
取消评论通知
这是目前唯一的功能!而且只执行了一半!
如果使用Disqus作为注释,则可以提供 post comment javascript钩子通知post作者新的注释。 下面是一些可以启用注释通知的javascript示例:
var newComment = function(comment) { var url = window.location.href + "disqus/"; var params = { id: comment.id, text: comment.text, csrfmiddlewaretoken: csrftoken // you'll have to get this from somewhere }; $.post(url, comment, function(data) { // don't really need to do anything }); }; var disqus_config = function() { this.callbacks.onNewComment = [function(comment) { newComment(comment); }]; };
注释终结点位于<path_to_blog>/<year>/<month>/<day>/<slug>/disqus/。它接受以下post参数:
- id the Disqus ID of the comment
- text the text of the comment
- csrfmiddlewaretoken a CSRF token, if protection is enabled
请参阅onNewComment回调,了解如何实现自己的回调。
未来的版本将连接到discusapi来完成各种任务。