Commit 573c7be6 authored by Claude Paroz's avatar Claude Paroz

Add variable check in role form

parent 134bd385
......@@ -57,16 +57,18 @@ class EditMemberRoleForm(forms.Form):
def __init__(self, roles, *args, **kwargs):
super().__init__(*args, **kwargs)
choices = list(filter(lambda x:x[0]!='coordinator', ROLE_CHOICES))
choices.append(('inactivate', _("Mark as Inactive")))
choices.append(('remove', _("Remove From Team")))
choices = [x for x in ROLE_CHOICES if x[0] != 'coordinator']
choices.extend([
('inactivate', _("Mark as Inactive")),
('remove', _("Remove From Team"))
])
for role in roles:
self.fields[str(role.pk)] = forms.ChoiceField(
choices=choices,
label = "<a href='%s'>%s</a>" % (role.person.get_absolute_url(), role.person.name),
label='<a href="%s">%s</a>' % (role.person.get_absolute_url(), role.person.name),
initial=role.role)
self.fields['form_type'] = forms.CharField(widget=forms.HiddenInput,
initial=roles[0].role)
if roles:
self.fields['form_type'] = forms.CharField(widget=forms.HiddenInput, initial=roles[0].role)
def get_fields(self):
for key, field in self.fields.items():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment