mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
custom profile field: Add at-least-one-choice validation for choice field.
Add validation at-least-one-choice required for every choice type field in backend.
This commit is contained in:
committed by
Tim Abbott
parent
a9c8d9b3d9
commit
2a73b2b805
@@ -49,6 +49,10 @@ def create_realm_custom_profile_field(request: HttpRequest,
|
||||
if field_type not in field_types:
|
||||
return json_error(_("Invalid field type."))
|
||||
|
||||
# Choice type field must have at least have one choice
|
||||
if field_type == CustomProfileField.CHOICE and len(field_data) < 1:
|
||||
return json_error(_("Field must have at least one choice."))
|
||||
|
||||
error = validate_field_data(field_data)
|
||||
if error:
|
||||
return json_error(error)
|
||||
|
||||
Reference in New Issue
Block a user