Reverted one of the changes in [13296], and added a comment explaining the relationship between the role list in roles_for_group_type() and the fields in the following GroupForm.

- Legacy-Id: 13297
Note: SVN reference [13296] has been migrated to Git commit a59331dd63
This commit is contained in:
Henrik Levkowetz 2017-05-10 13:22:16 +00:00
parent a59331dd63
commit d82b8bf036
3 changed files with 13 additions and 10 deletions

View file

@ -242,11 +242,3 @@ def construct_group_menu_context(request, group, selected, group_type, others):
d.update(others)
return d
def roles_for_group_type(group_type):
roles = ["chair", "secr", "techadv", "delegate", ]
if group_type == "dir":
roles.append("reviewer")
return roles

View file

@ -59,8 +59,9 @@ from ietf.group.models import Group, Role, ChangeStateGroupEvent
from ietf.name.models import GroupTypeName
from ietf.group.utils import (get_charter_text, can_manage_group_type,
milestone_reviewer_for_group_type, can_provide_status_update,
can_manage_materials, get_group_or_404, roles_for_group_type,
can_manage_materials, get_group_or_404,
construct_group_menu_context, get_group_materials)
from ietf.group.views_edit import roles_for_group_type
from ietf.community.utils import docs_tracked_by_community_list
from ietf.community.models import CommunityList, EmailSubscription
from ietf.utils.pipe import pipe

View file

@ -17,7 +17,7 @@ from ietf.doc.utils_charter import charter_name_for_group
from ietf.group.models import ( Group, Role, GroupEvent, GroupHistory, GroupStateName,
GroupStateTransitions, GroupTypeName, GroupURL, ChangeStateGroupEvent )
from ietf.group.utils import (save_group_in_history, can_manage_group, can_manage_group_type,
get_group_or_404, setup_default_community_list_for_group, roles_for_group_type, )
get_group_or_404, setup_default_community_list_for_group, )
from ietf.ietfauth.utils import has_role
from ietf.person.fields import SearchableEmailsField
from ietf.person.models import Person, Email
@ -26,6 +26,16 @@ from ietf.utils.ordereddict import insert_after_in_ordered_dict
from ietf.utils.text import strip_suffix
# This function, in addition to encapsulating a group's roles list for
# readability, also ensures that the roles with edit buttons in forms
# are the same which are accepted byt the GroupForm. Please adjust the
# list here if you change the *_roles fields the GroupForm knows about.
def roles_for_group_type(group_type):
roles = ["chair", "secr", "techadv", "delegate", ]
if group_type == "dir":
roles.append("reviewer")
return roles
MAX_GROUP_DELEGATES = 3
class GroupForm(forms.Form):