8

私はのドキュメントを読んでいますがdjango-notification、通知の作成については問題なくカバーしているようですが、ユーザーに通知を表示する方法については説明していません。そこにこれについての良い参考文献があります、そして私のグーグルフーはちょうど私に失敗しましたか?そうでない場合、誰かが私にここでいくつかのポインタを与えることができますか?ありがとう。

4

2 に答える 2

4

答えは、独自のテンプレートに組み込む必要があるということです。これは、次のスニペットのように簡単です。

<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>

@googletorpが答えたように、Pinaxは、著者がどのように使用しているかを把握するための場所ですdjango-notification。特に、便利なガイドとして役立つ通知管理ページがあります。

于 2009-12-23T15:58:13.483 に答える
2

ソースがgithubにあるPinaxを見てみましょう。彼らはプロジェクトサイトhttp://code.pinaxproject.comで通知を頻繁に使用します。

編集:
私はそれを見てみました。Pinaxがそれを機能させるために行うことは、他の外部アプリの前にインストール済みアプリにリストし、通常どおりにurlsファイルを含めることだけのようです。

于 2009-10-22T20:37:43.270 に答える