theatlantic / django-chosen Goto Github PK
View Code? Open in Web Editor NEWdjango FormFields using the Chosen javascript plugin for jQuery
License: Other
django FormFields using the Chosen javascript plugin for jQuery
License: Other
This issue is also reported in harvesthq/chosen#345
Django's div.form-row
has overflow: hidden
which makes dropdown select hidden.
Hello!
I want to initialize choosen widget with specific options:
https://harvesthq.github.io/chosen/options.html
Can you add supporting choosen options from the python code
chosen.jquery.js line 266:
$ = (typeof window.django != 'undefined') ? django.jQuery : jQuery;
gets optimized(?) to
a=(django?django.jQuery:jQuery)
This results in an error when not using django.jQuery
Hi
Your README is wrong, you copied it from your python-blogger project and didn't update it correctly
By the way, the proper format to install from pip is pip install -e git+git://github.com/theatlantic/django-chosen.git#egg=django-chosen, that can be added in a requirements.txt file. As you already created a setup.py, you could also upload it on the pip packages.
Other point, you didn't commit anything since August, so I'm wondering if this project is still maintained ?
Thank you very much for your answers, and for your hard work on this project
is there any possibility to update to new https://github.com/harvesthq/chosen ?
Hello,
I have installed django-chosen extension by PIP successfully,
$ pip install -e git+git://github.com/theatlantic/django-chosen.git#egg=django-chosen
however when I try to import it in my forms.py:
"import from chosen import forms as chosenforms"
it throws an error. It doesn't see it. Any idea why? The documentation doesn't mention any other setup steps. So I am really stuck on this.
Many thanks for your advice,
Houman
P.S. this is how I installed it:
`$ sudo pip install -e git+git://github.com/theatlantic/django-chosen.git#egg=django-chosen
Obtaining django-chosen from git+git://github.com/theatlantic/django-chosen.git#egg=django-chosen
Cloning git://github.com/theatlantic/django-chosen.git to /src/django-chosen
Running setup.py egg_info for package django-chosen
warning: manifest_maker: MANIFEST.in, line 5: unknown action 'reverse-include'
Installing collected packages: django-chosen
Running setup.py develop for django-chosen
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
warning: manifest_maker: MANIFEST.in, line 5: unknown action 'reverse-include'
Creating /usr/local/lib/python2.7/dist-packages/django-chosen.egg-link (link to .)
Adding django-chosen 0.1 to easy-install.pth file
Installed /src/django-chosen
Successfully installed django-chosen
Cleaning up...`
I get this error in Chrome. It seems that the chosen code relies on $.browser, which was deprecated and is now long removed, making django-chosen broken out of the box.
On the two admin models where I use chosen widgets, the verbose_name field labels ,translated using gettext like the others are showing up untranslated.
I'll try to integrate without overriding the field to see if it's better.
This line is different, and making the minified version break, at least on django1.4:
$ = (typeof window.django != 'undefined') ? django.jQuery : jQuery;
Works fine when using the non-minified version.
Apart from that, I really like your tool. Thanks!
Hi,
I have this below that customised my model multiplechoicefield.
How do I integrate this with django chosens chosenforms.ChosenMultipleChoiceField?
class UserMultiChoiceField(ModelMultipleChoiceField):
def label_from_instance(self, obj):
return "%s | %s %s" % (obj.sotup.nric, obj.sotup.first_name, obj.sotup.last_name)
Installed using instructions provided here. ChosenSelect performs fine on pages I make myself, but is giving me issues when used in the admin. In particular, I have:
models.py:
class MyModel(models.Model)
othermodel = models.ForeignKey(otherModel)
forms.py
class MyModelForm(models.ModelForm)
class Meta:
model = MyModel
widgets = { 'othermodel':chosen.widgets.ChosenSelect() }
admin.py
class MyModelAdmin(admin.ModelAdmin)
form = MyModelForm
When I do this, I get a "weird looking" admin page. Fields have been rearranged/jostled, but Chosen is not working properly. Is this related to various copies of jquery not playing well with one another?
Hi guys. Great work on this.
However, I just found out that you've deprecated this module in favor of django-select2-forms by going through the open issues. A little pointer in the readme might be nice, so everyone knows that there's an even greater library for select fields out there.
Since django-admin uses an old version of jQuery (1.4.2), and django-chosen uses jQuery included in django-admin, el.data('placeholder')
returns null
One approach would be to use jQuery
instead of django.jQuery
if provided.
Then I could include my own version of jQuery into the model admin.
I have a model in an app like this :
class Member(models.Model):
....
category = models.ManyToManyField(MemberCategory,
blank=True,
null=True, verbose_name=_(u'category'))
admin.py:
class MemberAdminForm(forms.ModelForm):
category = chosenforms.ChosenModelMultipleChoiceField(
overlay=_(u"Choose one or more categories"),
queryset=MemberCategory.objects.all())
With this setup, I cannot save the model without choosing a category : it's like if null=True was overriden
I am trying to use the chzn-select-deselect class on a field but chzn-select keeps getting added as well.
This breaks the functionality.
There should be a way to feed in the modality of the field at some step in the instantiation process.
When adding the widget, in a django 1.3.1 admin site I just have this error in Firebug :
$ is not a function
http://localhost:8000/static/js/chosen.jquery_ready.js?v=1
Line 2
very strange. I installed django-chosen on my Mac and onto my Linux VM using pip install (with or without -e option)
On the mac, I have the static folder, but not on Linux.
Perhaps you're missing a MANIFEST.IN file to specify .css and .js files ?
Please tag a new release as there are some bugs in the current one (django ternary, using older jquery deprecated functions...)
pip install -e git+git://github.com/theatlantic/django-chosen.git#egg=django-chosen
--editable=git+git://github.com/theatlantic/django-chosen.git is not the right format; it must have #egg=Package
any idea why this wouldn't work?
Could you make this available on PyPi http://pypi.python.org/?
Chosen is at 0.9.8 now:
https://github.com/harvesthq/chosen/tree/v0.9.8
It would be great to have django-chosen updated to match that version.
Thanks!
Chosen released version 1.0.0 a few months ago. There have been a number of improvements since 0.10.0, the current version in django-chosen.
Note that some changes will require a small amount of code refactoring (like using "chosen" instead of "chzn" for class names). See here for more details: https://github.com/harvesthq/chosen/releases/tag/1.0.0
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.