django-wiki / django-nyt

Notification system for Django with batteries included: Email digests, user settings, JSON API
Apache License 2.0
144 stars 47 forks source link

Add a filter_include option for the notify function? #135

Open benjaoming opened 10 months ago

benjaoming commented 10 months ago

It's not possible to frame all logic within filter_exclude and therefore, we should probably introduce a companion.

These filters are quite important for systems that need extra guarantees. There are cases where the set of notified users can fluctuate and inaccuracies can produce small leaks of information to the wrong users. This could be for instance if the consent is stored in another database table that needs to be queried.

Another way to use these filters is to have a dynamic set of subscribers. I.e. you can express "anyone who is currently a superuser" through filter_include={"settings__user__is_superuser": True}

https://github.com/django-wiki/django-nyt/blob/86eafaba5b88e5abdc6bceb815f311b96bd6d62a/django_nyt/utils.py#L14-L60