Improve the usage of bsmselect jquery plugin.

Allow to disable the plugin for defined <select multiple> form fields
with extra css class 'dont_use_bsmselect'. (E.g. not for the group form
fields permissions and users.)

Partly fixed changes from pull request #1381.
This commit is contained in:
Emanuel Schuetze 2015-01-08 10:58:25 +01:00
parent 088216b320
commit 91cef13326
2 changed files with 5 additions and 4 deletions

View File

@ -136,7 +136,7 @@
<script type="text/javascript" src="{% static 'js/jquery/jquery.bsmselect.js' %}"></script>
<script type="text/javascript">
// use jquery-bsmselect for all <select multiple> form elements
$("select[multiple]").bsmSelect({
$("select[multiple]:not(.dont_use_bsmselect)").bsmSelect({
removeLabel: '<sup><b>X</b></sup>',
containerClass: 'bsmContainer',
listClass: 'bsmList-custom',

View File

@ -84,10 +84,11 @@ class UserUpdateForm(UserCreateForm):
class GroupForm(forms.ModelForm, CssClassMixin):
permissions = LocalizedModelMultipleChoiceField(
queryset=Permission.objects.all(), label=ugettext_lazy('Permissions'),
required=False)
queryset=Permission.objects.all(), label=ugettext_lazy('Permissions'), required=False,
widget=forms.SelectMultiple(attrs={'class': 'dont_use_bsmselect'}))
users = forms.ModelMultipleChoiceField(
queryset=User.objects.all(), label=ugettext_lazy('Participants'), required=False)
queryset=User.objects.all(), label=ugettext_lazy('Participants'), required=False,
widget=forms.SelectMultiple(attrs={'class': 'dont_use_bsmselect'}))
class Meta:
model = Group