Permalink
Browse files

Only count on_site notices in the context processor (also unseen_coun…

…t_for now calls notices_for).

git-svn-id: http://django-notification.googlecode.com/svn/trunk@159 590c3fc9-4838-0410-bb95-17a0c9b37ca9
  • Loading branch information...
1 parent 3f18d36 commit 0f2d6f341399baf49a00c128865bba78e5261275 @brosner brosner committed Mar 13, 2009
Showing with 5 additions and 3 deletions.
  1. +3 −1 notification/context_processors.py
  2. +2 −2 notification/models.py
@@ -2,6 +2,8 @@
def notification(request):
if request.user.is_authenticated():
- return {'notice_unseen_count': Notice.objects.unseen_count_for(request.user),}
+ return {
+ 'notice_unseen_count': Notice.objects.unseen_count_for(request.user, on_site=True),
+ }
else:
return {}
@@ -114,12 +114,12 @@ def notices_for(self, user, archived=False, unseen=None, on_site=None):
qs = qs.filter(on_site=on_site)
return qs
- def unseen_count_for(self, user):
+ def unseen_count_for(self, user, **kwargs):
"""
returns the number of unseen notices for the given user but does not
mark them seen
"""
- return self.filter(user=user, unseen=True).count()
+ return self.notices_for(user, unseen=True, **kwargs).count()
class Notice(models.Model):

0 comments on commit 0f2d6f3

Please sign in to comment.