jtauber-archive / django-notification

user notification management for the Django web framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: ObservedModel

zerok opened this issue · comments

http://code.google.com/p/django-notification/issues/detail?id=20

Reported by carl.j.meyer, Dec 01, 2008

The included ObservedItem class and associated helper methods are excellent
for letting users subscribe to notifications of changes to a single object.

I also have a need to allow users to turn on/off "observation" of an entire
model class, so they will be notified anytime a new object of that type is
created.

This could be handled with a separate ObservedModel or ObservedType class,
or it could be handled by allowing null values for the object_id field in
ObservedItem, and handling that as a special case (this seems a bit ugly,
as it breaks the GFK). I think I prefer the former, and since I need it
now, I'll implement it outside of django-notification and post a patch here
for possible inclusion.

Comment 1 by carl.j.meyer, Dec 01, 2008

Ahh, silly me. If I'd done the work before posting the issue, I'd have realized
that ObservedItem can handle this case just fine, since observed_object can itself be
a ContentType object. Having a GFK point to a ContentType is an unnecessary extra
level of redirection, but that's probably worth it for the code simplicity.

Comment 2 by eduardo.padoan, Dec 02, 2008

Yes, but this possibility is a bit non-obvious, right?