Open lowegreg opened 5 years ago
Yup, it's the test project in the root of the repo:
https://github.com/django-wiki/django-nyt/tree/master/test-project
Thanks for the reply. I was looking for something a bit more explicit. In case anyone else stumbles across this post, below is the code I wrote to subscribe to an content type and then send a message. In this case they are based around projects. Use or ignore as you see fit...
Send welcome notification
from django.utils.translation import ugettext as _ from django_nyt.utils import notify, subscribe from django_nyt.models import Settings from django.contrib.contenttypes.models import ContentType
user = User.objects.get(id = userID) ct = ContentType.objects.get(model="project") settings = Settings.get_default_setting(user) sendUsers = User.objects.filter(id = userID)
EVENTKEY = "project"+str(projectID) subscribe(settings, EVENTKEY, ct) notify(("You have been added to the " + EVENT_KEY + " project."), EVENT_KEY, None, "/project/"+str(projectID)+"/projectsummary/", {}, sendUsers)
@lowegreg there is a bit of documentation examples for invoking notify()
but perhaps an example for creating a settings object, a subscription and a final notification would be nice to have in the documentation.
I know this isn't an actual issue, but wondering if anyone has a sample that includes how to setup events and then allow uses to subscribe/unsubscribe to them.
Cheers, Greg