Open gotounix opened 6 years ago
What happens if you disable autocomplete of django-jet ?
I also have the same problem. I disabled autocomplete of django-jet according to this instruction http://jet.readthedocs.io/en/latest/autocomplete.html#disabling-autocomplete-for-form-fields --> doesn't work, still duplicate select2 fields.
any other solution?
django==2.0.5 django-jet==1.0.7 django-autocomplete-light==3.2.10
What happens if you disable both DAL and jet autocomplete ? Do you get a normal select field ?
In the same django app, I have another form that didn't use DAL, and it show jet select field (autocomplete) correctly.
What happens if you disable both DAL and jet autocomplete ? Do you get a normal select field without select2 ? ie. plain html
I had the chance to fix this in a project today, it was like: copy jet's bundle.min.js for override, replace find("select").trigger("select:init") with find("select:not([data-autocomplete-light-function])").trigger("select:init")
The tradeoff:
It's going to be hard to do any better, given that DAL and Jet both have their initialization functions. The other way around would be to define a new autocomplete js initialization that does not create a new autocomplete, but rather, reconfigures the one created by django-jet.
Another option is:
admin config:
@admin.register(YourModel)
class YourModelAdmin(admin.ModelAdmin):
class Media:
css = {"all": ("your-model.css",)}
your-model.css:
.select2-container--default + .select2-container--jet {
display: none;
}
and jet theme select2 is hidden if it's a sibling of django-autocomplete-light select2
There are two
select2
fields when use it in django-jet.