Updated some functions and views in secr/srec/ to use GroupFeatures instead of harcoded lists of group types.
- Legacy-Id: 16301
This commit is contained in:
parent
da5ff11538
commit
f9cd72168f
|
@ -491,7 +491,8 @@ def main(request):
|
|||
)
|
||||
|
||||
meeting = get_meeting()
|
||||
scheduled_groups,unscheduled_groups = groups_by_session(request.user, meeting, types=['wg','rg','ag'])
|
||||
|
||||
scheduled_groups, unscheduled_groups = groups_by_session(request.user, meeting)
|
||||
|
||||
# warn if there are no associated groups
|
||||
if not scheduled_groups and not unscheduled_groups:
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright The IETF Trust 2013-2019, All Rights Reserved
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Python imports
|
||||
import os
|
||||
|
||||
|
@ -6,7 +9,7 @@ from django.conf import settings
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
# Datatracker imports
|
||||
from ietf.group.models import Group
|
||||
from ietf.group.models import Group, GroupFeatures
|
||||
from ietf.meeting.models import Session
|
||||
from ietf.ietfauth.utils import has_role
|
||||
|
||||
|
@ -49,9 +52,8 @@ def get_my_groups(user,conclude=False):
|
|||
states = ['bof','proposed','active']
|
||||
if conclude:
|
||||
states.extend(['conclude','bof-conc'])
|
||||
types = ['wg','rg','ag','team','iab']
|
||||
|
||||
all_groups = Group.objects.filter(type__in=types,state__in=states).order_by('acronym')
|
||||
|
||||
all_groups = Group.objects.filter(type__features__has_meetings=True, state__in=states).order_by('acronym')
|
||||
if user == None or has_role(user,'Secretariat'):
|
||||
return all_groups
|
||||
|
||||
|
@ -94,8 +96,10 @@ def groups_by_session(user, meeting, types=None):
|
|||
if group.state_id not in ('conclude','bof-conc'):
|
||||
groups_no_session.append(group)
|
||||
|
||||
if types:
|
||||
groups_session = filter(lambda x: x.type_id in types,groups_session)
|
||||
groups_no_session = filter(lambda x: x.type_id in types,groups_no_session)
|
||||
if not types:
|
||||
types = GroupFeatures.objects.filter(has_meetings=True).values_list('type', flat=True)
|
||||
|
||||
groups_session = filter(lambda g: g.type_id in types, groups_session)
|
||||
groups_no_session = filter(lambda g: g.type_id in types, groups_no_session)
|
||||
|
||||
return groups_session, groups_no_session
|
||||
|
|
Loading…
Reference in a new issue