Add save button and temp member role toggle to env member form

This commit is contained in:
leigh-mil
2019-05-01 13:52:49 -04:00
parent aab01b3947
commit 060c6834bf
12 changed files with 148 additions and 39 deletions

View File

@@ -1,14 +1,19 @@
from flask_wtf import FlaskForm
from wtforms.fields import StringField, HiddenField, RadioField, FieldList, FormField
from wtforms.fields import FieldList, FormField, HiddenField, RadioField
from .forms import BaseForm
from .data import ENV_ROLES
class EnvMemberRoleForm(FlaskForm):
name = StringField()
user_id = HiddenField()
role = RadioField(choices=ENV_ROLES, coerce=BaseForm.remove_empty_string)
role = RadioField(choices=ENV_ROLES, default="no_access")
@property
def data(self):
_data = super().data
_data.pop("csrf_token", None)
return _data
class EnvironmentRolesForm(BaseForm):

View File

@@ -217,4 +217,6 @@ REQUIRED_DISTRIBUTIONS = [
("other", "Other as necessary"),
]
ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [(None, "No access")]
ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [
("no_access", "No access")
]