2024-05-16 21:34:53 发布
网友
我一直在阅读^{}的文档,它们似乎很好地涵盖了创建通知,但不包括如何向用户显示通知。有没有很好的参考资料,我的Google fu刚刚让我失望?如果没有,有人能给我点提示吗?谢谢。
故事看看Pinax可以在github上找到源代码。他们经常为他们的项目站点http://code.pinaxproject.com使用通知。
编辑: 我只是看了一下。看起来Pinax所做的工作就是在其他外部应用之前将其列在已安装的应用中,并像您通常所做的那样包含它的URL文件。
答案是你必须把它构建成你自己的模板。这可以像下面的代码片段一样简单:
<table> <caption>{% trans "Notices" %}</caption> <thead> <tr> <th>{% trans "Type" %}</th> <th>{% trans "Message" %}</th> <th>{% trans "Date of the Notice" %}</th> </tr> </thead> <tbody> {% for notice in notices %} {% if notice.is_unseen %} <tr class="unseen_notice"> {% else %} <tr class="notice"> {% endif %} <td class="notice_type">[{% trans notice.notice_type.display %}]</td> <td class="notice_message">{{ notice.message|safe }}</td> <td class="notice_time">{{ notice.added|timesince }} {% trans "ago" %}</td> </tr> {% endfor %} </tbody> </table>
作为@googletorpanswered,Pinax是找出作者是如何使用django-notification的goto位置。特别是,有一个通知管理页面,可以作为一个方便的指南。
django-notification
故事看看Pinax可以在github上找到源代码。他们经常为他们的项目站点http://code.pinaxproject.com使用通知。
编辑:
我只是看了一下。看起来Pinax所做的工作就是在其他外部应用之前将其列在已安装的应用中,并像您通常所做的那样包含它的URL文件。
答案是你必须把它构建成你自己的模板。这可以像下面的代码片段一样简单:
作为@googletorpanswered,Pinax是找出作者是如何使用
django-notification
的goto位置。特别是,有一个通知管理页面,可以作为一个方便的指南。相关问题 更多 >
编程相关推荐