chhantyal / taggit-selectize Goto Github PK
View Code? Open in Web Editor NEWAuto-complete/auto-suggestion for django-taggit (django-taggit + selectize.js)
License: BSD 3-Clause "New" or "Revised" License
Auto-complete/auto-suggestion for django-taggit (django-taggit + selectize.js)
License: BSD 3-Clause "New" or "Revised" License
Hi,
First of all, thank you for this great tool ๐
On my side, there is only two problems on my side:
Thanks again, and have a wonderful day :)
can this be implemented in a user form ? Any Info on how to do this?
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.
I use simpleui and taggit-selectize get this error.
Uncaught TypeError: $(...).selectize is not a function
but it works when use django.jQuery().selectize
relate to #31
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'
Thanks reddit/moustachaaa
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')
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",
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
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 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?
Any idea how to use it with django rest framework ?
There is no sample html to demonstrate how the widget should be implemented. I think it would be highly useful.
As there can be jQuery plugins that might depend on it.
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
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
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.
force_text()
is deprecated and is being removed in Django 4.0 (to be released in December), the replacement is force_str()
.
Currently on Django 3.2 it gives a RemovedInDjango40Warning: force_text() is deprecated in favor of force_str().
tagstring = force_text(tagstring)
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?
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.
The following should be replaced with django.urls.re_path
to be compatible with Django 4.0:
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"
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.