Mercurial > public > sg101
diff gpp/forums/models.py @ 170:6f14970b103a
Implement #52 Forums RSS feeds.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 11 Feb 2010 02:29:03 +0000 |
parents | cf9f9d4c4d54 |
children | 500e5875a306 |
line wrap: on
line diff
--- a/gpp/forums/models.py Sun Jan 31 04:52:08 2010 +0000 +++ b/gpp/forums/models.py Thu Feb 11 02:29:03 2010 +0000 @@ -42,6 +42,10 @@ return self.groups.filter(user__pk=user.id).count() > 0 return False + def is_public(self): + """Returns true if this is a public category, viewable by all.""" + return self.groups.count() == 0 + class ForumManager(models.Manager): """ @@ -62,6 +66,10 @@ qs = self._for_user(user) return qs.values_list('id', flat=True) + def public_forums(self): + """Returns a queryset containing the public forums.""" + return self.filter(category__groups__isnull=True) + def _for_user(self, user): """Common code for the xxx_for_user() methods.""" if user.is_superuser: