comses.net
comses.net copied to clipboard
split incoming tags
Multiple fixes for this:
- frontend shouldn't allow tags over 100 chars (always)
- frontend could split by ';' or ','
- backend serializer should raise a validation error if tag names > 100 chars (always)
- backend could split by ';' or ',' as well but this seems magical and could strip out legitimate semicolony tags (not sure if that should exist though)
Thoughts?
TagSerializer(data=[OrderedDict([('name', 'Energy security; energy landscape; Egypt; multi-criteria decision analysis; agent-based modeling; Geographic Information System')])], many=True):
name = CharField()
- sure
- would take some work. There is an issue about 2 on shentao/vue-multiselect#575 so maybe someone will get around to fixing it eventually (or I could attempt it as well). We would also need to split tags on the input event since it was likely that the tags from copy pasted from a journal article.
- from a serializer override so that's an easy fix
- splitting on ';' and ',' on the backend makes sense to me. I don't see why there would ever be commas or semicolons in a tag name
Actually 2 shouldn't be too hard either so long as it's acceptable to have a large search string and then when the user presses enter the incoming string is split by ';' and ','. An incremental split would be more difficult (creating a new tag as soon as the user presses ',' or ';').
Yes, split on enter / onBlur / whenever the submitter moves on from the tag input field