GithubHelp home page GithubHelp logo

chhantyal / taggit-selectize Goto Github PK

View Code? Open in Web Editor NEW
68.0 68.0 23.0 160 KB

Auto-complete/auto-suggestion for django-taggit (django-taggit + selectize.js)

License: BSD 3-Clause "New" or "Revised" License

Python 16.78% CSS 8.06% JavaScript 75.16%
django django-application django-taggit python selectize

taggit-selectize's People

Contributors

akiat avatar ampotos avatar andrekeller avatar andytwoods avatar ataraspost avatar bashu avatar charleszlu avatar chhantyal avatar nshafer avatar simonavril avatar vdboor avatar yswtrue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taggit-selectize's Issues

taggit-selectize in templates

hi

this library only works in admin?
because when trying to use is a template it does not generate the field in the formual as shown in the image following the documentation.

Safari form submission broken

My form is not submitting in Safari, when using Taggit-Selectize. When I remove the field, it does submit. I'm currently exploring selectize.js for any incompatibilty issues. Don't think it's anything to do with accidental ES6 feature usage as submission works fine in Internet Explorer 11.

close_after_select config value

In widgets.py 'close_after_select' depends on 'settings.TAGGIT_SELECTIZE['CREATE']' value:
'close_after_select': "true" if settings.TAGGIT_SELECTIZE['CREATE'] else "false",

Is there any reason that it not depends on settings.TAGGIT_SELECTIZE['CLOSE_AFTER_SELECT'] value?:
'close_after_select': "true" if settings.TAGGIT_SELECTIZE['CLOSE_AFTER_SELECT'] else "false",

PyPi Install error

Downloading/unpacking taggit-selectize
  Downloading taggit-selectize-0.1.0.tar.gz
  Running setup.py egg_info for package taggit-selectize
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/private/tmp/pip_build_root/taggit-selectize/setup.py", line 23, in <module>
        readme = open('README.md').read()
    IOError: [Errno 2] No such file or directory: 'README.md'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/private/tmp/pip_build_root/taggit-selectize/setup.py", line 23, in <module>

    readme = open('README.md').read()

IOError: [Errno 2] No such file or directory: 'README.md'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/taggit-selectize
Storing complete log in /Users/julian/.pip/pip.log

Update selectize.js to latest version

There have been a few releases of selectize.js as of lately, updating to the latest version would probably make sense.

Also it seems currently 0.12.2 is bundled and not 0.12.1 as mentioned in the readme.

Is the Example App Compatible with Django 2.1.5?

I'm having trouble getting it to work, I've tried editing the url.py files to use PATH() and run server works but I keep getting 404 for localhost:8000/taggit

I'd really appreciate it if you could let me know the most recent version the example application worked on.

Thanks for the good work

with DRF

Any idea how to use it with django rest framework ?

Make taggit-selectize responsive and add a new tag with comma (on mobile)

Hi,

First of all, thank you for this great tool ๐Ÿ‘

On my side, there is only two problems on my side:

  1. On mobile, the field is not responsive and it's not possible to scroll to the right of the screen to show the added tags (or to easily click on blank area to add a new one)
  2. On mobile, the comma don't add a new tag.

Thanks again, and have a wonderful day :)

Order by length of tag name

We have a taggit database of several thousand tags. Some are single words while others are multiple words in a single tag. One of the issues we found in working with Taggit is the ordering of the results would sometimes bury the single word tags below the multiple word tags and they wouldn't appear in the results list.

I solved this by customizing the get_tags_recommendation() view for this project. I wanted to share it here in case you find it something worth considering for the project codebase. Perhaps pair it with a setting variable for SORT_TYPE, etc. Happy to put together a pull request if you think it's valuable.

Here's the customized view that I created. Essentially it's the same view just adding the extra and order_by methods:

def get_tags_recommendation(request):
    query = request.GET.get('query')
    limit = settings.TAGGIT_SELECTIZE['RECOMMENDATION_LIMIT']
    if query:
        tags = Tag.objects.filter(name__icontains=query).extra(select={'length':'Length(name)'}).order_by('length').values('name')[:limit]
    else:
        tags = Tag.objects.all().extra(select={'length':'Length(name)'}).order_by('length').values()[:limit]

    data = json.dumps({
        'tags': list(tags)
    })

    return HttpResponse(data, content_type='application/json')

ModuleNotFoundError: No module named 'taggit-selectize'

Installed just the way as listed in the README.md and ran into this error

ModuleNotFoundError: No module named 'taggit-selectize'

I've uninstalled the package several times and installed it via pip and requirements both give me the same issue. Also, tried this similar issue answer but no luck esoergel/peacecorps#37, Any ideas?

Using taggit-selectize with django 3

Has anyone successfully used taggit-selectize with django 3

It doesn't autocomplete the model when typing into the model field, it only shows "Add"

Theming support

So now that Django has added dark theme as well, it would be great to have this plugin support dark theme too, because when using this plugin on Dark Mode, it sticks out from the rest of the Admin.

Django 3.0 support

six is not available in django.utils in Django 3

"six" was depreciated from django.utils
https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis

Found a possible answer here
https://stackoverflow.com/questions/59193514/importerror-cannot-import-name-six-from-django-utils

This is a package that replaces it
https://pypi.org/project/six/

Wherever "six" was you can replace it with PY3
https://six.readthedocs.io/

Make sure to replace
from django.utils import six
with
from six import *

New issue appeared

...\venv\lib\site-packages\taggit_selectize\widgets.py in render, line 22
'bool' object has no attribute 'string_types'

Items should split if not in quotes

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:

  1. User with an empty input enters the string foo bar in the input.
  2. The term foo bar is not an existing Tag object so the user chooses "Add foo bar..." in the results pane.
  3. Selectize creates a single item that reads 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 tags foo and bar.

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?

Incompatible with django-taggit 1.0

When using taggit-selectize with django-taggit 1.0, the admin widget causes the following error:

File "....python3.7/site-packages/taggit_selectize/widgets.py" in render
  17.             value = edit_string_for_tags([o.tag for o in value.select_related("tag")])

Exception Type: AttributeError at /admin/blog/post/28/change/
Exception Value: 'list' object has no attribute 'select_related'

The breaking change seems to be: jazzband/django-taggit@fa36187 This also causes BoundField.value() returns a list now instead of a queryset.

Using Django 2.0.13, Python 3.7.

Reverting to django-taggit==0.24.0 is a workaround.

Update: I've added a pull request: #25

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.