Ich benutze dieses: https://github.com/pinax/django-notification/blob/master/docs/usage.txt
Also habe ich alle Schritte befolgt.
from notification import models as notification
#first, create the notification type.
notification.create_notice_type("comment_received", ("Comment Received"), ("You have received a comment."))
#then, send the notification.
notification.send(request.user, "comment_received", {})
Natürlich habe ich in meinem Vorlagenverzeichnis eine "Benachrichtigung" erstellt, so wie es das Dokument sagt.
Innerhalb /templates/notification/comment_received
Ich habe 4 Dateien:
- full.txt, short.txt, notice.html, full.html
Diese Dateien sind derzeit leer. Sie sagen nur einen zufälligen Satz.
Warum erhalte ich diesen Fehler, wenn ich versuche, die Benachrichtigung zu senden?
Exception Type: NoReverseMatch at /
Exception Value: Reverse for "notification_notices" with arguments "()" and keyword arguments "{}" not found.
Antworten:
5 für die Antwort № 1Haben Sie die richtigen URL-Konfigurationen angegeben? Sieht so aus, als ob Django in keiner Ihrer URLs "notification_notices" finden kann ...
https://github.com/pinax/django-notification/blob/master/notification/urls.py
Sie sollten auf diese in der urls.py Ihrer Site verweisen, z.
urlpatterns = patterns("",
(r"^notification/", include(notification.urls)),
...
1 für die Antwort № 2
Sie müssen einen Eintrag in Ihrem erstellen urls.py
Datei einschließlich der django-nofication urls.py Datei:
(r"^notifications/", include("notification.urls")),
Siehe die Django Dokumente Weitere Informationen zum Einbeziehen anderer urls.py
Dateien.