Trim possible attribute values like attribute values setup by a user (#1044)

main
Boris Sekachev 6 years ago committed by Nikita Manovich
parent c7d1c82aeb
commit 67239b6148

@ -67,6 +67,8 @@ class LabelForm extends React.PureComponent<Props, {}> {
}
}
attrValues = attrValues.map((value: string) => value.trim());
return {
name: formValues.attrName[key],
type: formValues.type[key],

@ -22,7 +22,7 @@ class AttributeSerializer(serializers.ModelSerializer):
# pylint: disable=no-self-use
def to_internal_value(self, data):
attribute = data.copy()
attribute['values'] = '\n'.join(data.get('values', []))
attribute['values'] = '\n'.join(map(lambda x: x.strip(), data.get('values', [])))
return attribute
def to_representation(self, instance):

Loading…
Cancel
Save