Projet

Général

Profil

« Précédent | Suivant » 

Révision 78bae9a3

Ajouté par Jérôme Schneider il y a presque 10 ans

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

warning: new dependency on django-select2

Voir les différences:

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)
calebasse/dossiers/templates/dossiers/patientrecord_update.html
10 10
{{ block.super }}
11 11
<script src="{{ STATIC_URL }}js/jquery.parse-url.js"></script>
12 12
<script src="{{ STATIC_URL }}js/calebasse.dossiers.js"></script>
13
<script src="{{ STATIC_URL }}filter-widget/js/i18n.js"></script>
14
<script src="{{ STATIC_URL }}filter-widget/js/core.js"></script>
15
<script src="{{ STATIC_URL }}filter-widget/js/SelectBox.js"></script>
16
<script src="{{ STATIC_URL }}filter-widget/js/SelectFilter2.js"></script>
17 13
{% endblock %}
18 14

  
19 15
{% block title %}{{ object.last_name }} {{ object.first_name }}{% if object.paper_id %} - Dossier {{ object.paper_id}}{% endif %}{% endblock %}
calebasse/settings.py
151 151
    'south',
152 152
    'django.contrib.admin',
153 153
    'ajax_select',
154
    'django_select2',
154 155
    #'debug_toolbar',
155 156
    'widget_tweaks',
156 157
    # Uncomment the next line to enable admin documentation:
calebasse/static/css/dossiers.css
112 112
    margin-top: .4em;
113 113
}
114 114

  
115
.select2-choices {
116
    font-size: 11pt;
117
}
calebasse/static/js/calebasse.dialog.js
77 77
}
78 78

  
79 79
/**
80
 * Transform form(s) into your id to ajax forms
80
 * Transform form(s) to ajax forms
81
 * id: jQuery id where you want to replace form by ajaxForm
81 82
*/
82 83
function calebasse_ajax_form(id) {
83 84
  function onsuccess(response, status, xhr, form) {
84
    $(id).html(response);
85
    $('form').ajaxForm({
86
      success: onsuccess,
87
    });
85
    if ($('.errorlist', response).length != 0) {
86
      $(id).html(response);
87
      $('form').ajaxForm({
88
        success: onsuccess,
89
      });
90
    }
91
    else {
92
      window.location.reload(true);
93
    }
88 94
  }
89 95
  $('form').ajaxForm({
90 96
    success: onsuccess,
calebasse/urls.py
27 27
    url(r'^personnes/', include('calebasse.personnes.urls')),
28 28
    url(r'^ressources/', include('calebasse.ressources.urls')),
29 29
    url(r'^statistics/', include('calebasse.statistics.urls')),
30
    url(r'^select2/', include('django_select2.urls')),
30 31
)
31 32

  
32 33
urlpatterns = patterns('',
requirements.txt
18 18
raven >= 3.5.2, < 3.6
19 19
M2Crypto
20 20
--allow-external pycairo
21
django_select2 < 4.3
21 22
#PyGTK doesn't work with pip
setup.py
50 50
            'django-ajax-selects < 1.3.0',
51 51
            'django-widget-tweaks < 1.2.0',
52 52
            'django-tastypie == 0.9.14',
53
            'django-select2 < 4.3',
53 54
            'interval == 1.0.0',
54 55
            'python-entrouvert >= 1.3'
55 56
            'django-localflavor',

Formats disponibles : Unified diff