Update role div height

Move serialization into the route
change member.role to member.role_name in form and route
Return 400 for invalid form submission
This commit is contained in:
leigh-mil
2019-05-13 11:29:24 -04:00
parent fd84e902e3
commit 546e04555d
6 changed files with 51 additions and 65 deletions

View File

@@ -8,14 +8,13 @@ from .data import ENV_ROLES
class MemberForm(FlaskForm):
user_id = HiddenField()
user_name = StringField()
role = RadioField(choices=ENV_ROLES, default="no_access")
role_name = RadioField(choices=ENV_ROLES, default="no_access")
@property
def data(self):
_data = super().data
for field in _data:
if field == "role" and _data[field] == "no_access":
_data[field] = None
if "role_name" in _data and _data["role_name"] == "no_access":
_data["role_name"] = None
return _data