GithubHelp home page GithubHelp logo

Comments (3)

nshafer avatar nshafer commented on June 26, 2024 2

I have released these fixes in a new version. Thanks for the report and the help!

from taggit-selectize.

chhantyal avatar chhantyal commented on June 26, 2024

Thanks for detailed issue report. That is definitely bug, @nshafer do you have any pointers for OP?

from taggit-selectize.

nshafer avatar nshafer commented on June 26, 2024

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 delimiter setting. With taggit-selectize, we do not change this setting nor do we expose it to the user through our own settings. I think I'll change this.

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 taggit_selectize.utils.parse_tags and updated the README to reflect the extra step of configuring Taggit to use it during installation.

TAGGIT_TAGS_FROM_STRING = 'taggit_selectize.utils.parse_tags'

I am going to make another change or two and have Nar push a new version to PyPi.

from taggit-selectize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.