|
| 1 | +# Copyright The IETF Trust 2013-2019, All Rights Reserved |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | + |
1 | 4 | # Python imports |
2 | 5 | import os |
3 | 6 |
|
|
6 | 9 | from django.core.exceptions import ObjectDoesNotExist |
7 | 10 |
|
8 | 11 | # Datatracker imports |
9 | | -from ietf.group.models import Group |
| 12 | +from ietf.group.models import Group, GroupFeatures |
10 | 13 | from ietf.meeting.models import Session |
11 | 14 | from ietf.ietfauth.utils import has_role |
12 | 15 |
|
@@ -49,9 +52,8 @@ def get_my_groups(user,conclude=False): |
49 | 52 | states = ['bof','proposed','active'] |
50 | 53 | if conclude: |
51 | 54 | states.extend(['conclude','bof-conc']) |
52 | | - types = ['wg','rg','ag','team','iab'] |
53 | | - |
54 | | - all_groups = Group.objects.filter(type__in=types,state__in=states).order_by('acronym') |
| 55 | + |
| 56 | + all_groups = Group.objects.filter(type__features__has_meetings=True, state__in=states).order_by('acronym') |
55 | 57 | if user == None or has_role(user,'Secretariat'): |
56 | 58 | return all_groups |
57 | 59 |
|
@@ -94,8 +96,10 @@ def groups_by_session(user, meeting, types=None): |
94 | 96 | if group.state_id not in ('conclude','bof-conc'): |
95 | 97 | groups_no_session.append(group) |
96 | 98 |
|
97 | | - if types: |
98 | | - groups_session = filter(lambda x: x.type_id in types,groups_session) |
99 | | - groups_no_session = filter(lambda x: x.type_id in types,groups_no_session) |
| 99 | + if not types: |
| 100 | + types = GroupFeatures.objects.filter(has_meetings=True).values_list('type', flat=True) |
| 101 | + |
| 102 | + groups_session = filter(lambda g: g.type_id in types, groups_session) |
| 103 | + groups_no_session = filter(lambda g: g.type_id in types, groups_no_session) |
100 | 104 |
|
101 | 105 | return groups_session, groups_no_session |
0 commit comments