Add custom manager to Group with convenience helper for getting active

WGs(requested by Ryan Cross)
 - Legacy-Id: 3704
This commit is contained in:
Ole Laursen 2011-11-24 17:18:55 +00:00
parent ca9dd9b61a
commit d8fe519440

View file

@ -29,7 +29,13 @@ class GroupInfo(models.Model):
class Meta:
abstract = True
class GroupManager(models.Manager):
def active_wgs(self):
return self.get_query_set().filter(type='wg', state__in=('bof','proposed','active'))
class Group(GroupInfo):
objects = GroupManager()
# we keep charter separate
charter = models.OneToOneField('doc.Document', related_name='chartered_group', blank=True, null=True)