-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Items should split if not in quotes #10
Comments
Thanks for detailed issue report. That is definitely bug, @nshafer do you have any pointers for OP? |
First, I apologize for not getting back to you.. I've just moved cities and things were really hectic. So, I just looked into this, and was able to replicate it. With further digging, I've come across the basic problem that Selectize and default Taggit have differing philosophies when it comes to supporting tags separated by either commas or spaces. Selectize has a default delimiter setting of of a comma, in the Taggit, on the other hand, has a default string-to-tag parser that tries to be intelligent and parse tags separated by spaces if there are no quotes or commas in the string. So the problem here is that according to Selectize, the string "foo bar" is a single tag, so no commas or quotes are necessary. This then gets posted to Taggit, which says, "hey there, no commas, no quotes, this must be a space-separated tag list" and then pulls each word out separately as a distinct tag. So the good news is that this is fixable, but really only by the user changing Taggit's default configuration. Taggit has a setting that allows you to override the default tag parser, documented here. Their example creates a super naive parser that causes other problems with how Selectize works, so instead I have adapted a version of their tag parser that will still properly work with quotes and commas, but doesn't ever treat spaces as a separator. I have included this function in
I am going to make another change or two and have Nar push a new version to PyPi. |
I have released these fixes in a new version. Thanks for the report and the help! |
I've been hacking at this for a few hours now and can't come up with a solution so I'm hoping that I can present the issue I'm seeing to get someone else's eyes on this.
Here are the steps to recreate the issue:
foo bar
in the input.foo bar
is not an existing Tag object so the user chooses "Add foo bar..." in the results pane.foo bar
.The problem here is that there are no double quotes around
foo bar
within the underlying hidden form input and so when the object is saved in the Django admin django-taggit will split the string into two separate tagsfoo
andbar
.This is a confusing user experience as one would expect selectize to have created two separate items rather than initially rendering it as one item. I played around with the taggit-selectize widget but could not come up with a solution that would split the items before rendering. Any ideas on how to get selectize to split the input into two items rather than rendering as a single item?
The text was updated successfully, but these errors were encountered: