Project

General

Profile

« Previous | Next » 

Revision 78bae9a3

Added by Jérôme Schneider almost 10 years ago

dossiers: fix MISES in health tab and replace FilteredSelect by select2

warning: new dependency on django-select2

View differences:

calebasse/dossiers/forms.py
18 18
    CodeCFTMEA, SocialisationDuration, MDPHRequest, MDPHResponse)
19 19

  
20 20
from ajax_select import make_ajax_field
21
from django_select2.widgets import Select2MultipleWidget
21 22

  
22 23
logger = logging.getLogger(__name__)
23 24

  
......
111 112
        fields = ('first_name', 'last_name', 'birthdate', 'birthplace', 'gender', 'nationality')
112 113

  
113 114

  
114
class FilteredSelectMultipleMise(django.contrib.admin.widgets.FilteredSelectMultiple):
115
    def __init__(self, **kwargs):
116
        super(FilteredSelectMultipleMise, self).__init__(u'Catégorie', False)
117

  
118 115
class PhysiologyForm(ModelForm):
119 116
    cranium_perimeter = forms.DecimalField(label=u"Périmètre cranien",
120 117
                    max_digits=5, decimal_places=2, localize=True,
......
135 132
            'deficiency_polyhandicap', 'deficiency_behavioral_disorder',
136 133
            'deficiency_in_diagnostic', 'deficiency_other_disorder')
137 134
        widgets = {
138
            'mises_1': FilteredSelectMultipleMise,
139
            'mises_2': FilteredSelectMultipleMise,
140
            'mises_3': FilteredSelectMultipleMise,
141
        }
135
                'mises_1': Select2MultipleWidget(attrs={'style': 'width: 32em'}),
136
                'mises_2': Select2MultipleWidget(attrs={'style': 'width: 32em'}),
137
                'mises_3': Select2MultipleWidget(attrs={'style': 'width: 32em'}),
138
                }
139

  
142 140

  
143 141
    def __init__(self, instance, **kwargs):
144 142
        super(PhysiologyForm, self).__init__(instance=instance, **kwargs)

Also available in: Unified diff