0001-alfortville-better-sorting-roles-on-copies-page-1242.patch
welco/contrib/alfortville/views.py | ||
---|---|---|
165 | 165 |
context['checked_info'] = checked_dicts[Inbox.INFO] |
166 | 166 |
context['checked_avis'] = checked_dicts[Inbox.AVIS] |
167 | 167 |
context['checked_mandatory_avis'] = checked_dicts[Inbox.MANDATORY_AVIS] |
168 |
context['roles'] = get_wcs_data('api/roles').get('data') |
|
169 |
context['roles'] = [x for x in context['roles'] if |
|
170 |
x['text'].startswith('Maire') or |
|
171 |
x['text'].startswith('Adjoint') or |
|
172 |
x['text'].startswith('Conseiller') or |
|
173 |
x['text'].startswith('Elu') or |
|
174 |
x['text'].startswith('Cabinet') or |
|
175 |
x['text'].startswith('Direction') or |
|
176 |
x['text'].startswith('DGA') or |
|
177 |
x['text'].startswith('DGS')] |
|
178 |
context['roles'].sort(lambda x, y: cmp(x['text'], y['text'])) |
|
168 |
context['roles'] = [] |
|
169 |
all_roles = get_wcs_data('api/roles').get('data') |
|
170 |
for start in ('Maire', 'Cabinet', 'Adjoint', 'Conseiller', 'Elu', 'DGS', 'DGA', |
|
171 |
'Direction'): |
|
172 |
roles = [x for x in all_roles if x['text'].startswith(start)] |
|
173 |
roles.sort(lambda x, y: cmp(x['text'], y['text'])) |
|
174 |
context['roles'].extend(roles) |
|
179 | 175 |
return context |
180 | 176 | |
181 | 177 |
def post(self, request, *args, **kwargs): |
182 |
- |