Projet

Général

Profil

0001-workflows-sort-profile-fields-in-widget-22791.patch

Lauréline Guérin, 06 juillet 2020 11:01

Télécharger (1,65 ko)

Voir les différences:

Subject: [PATCH] workflows: sort profile fields in widget (#22791)

 tests/test_widgets.py | 6 ++++++
 wcs/wf/profile.py     | 1 +
 2 files changed, 7 insertions(+)
tests/test_widgets.py
15 15
from wcs.qommon import sessions
16 16
from wcs.qommon.form import *
17 17
from wcs.qommon.http_request import HTTPRequest
18
from wcs.wf.profile import ProfileUpdateRowWidget
18 19

  
19 20
from utilities import create_temporary_pub
20 21

  
......
977 978
    assert 'data-max-bounds-lat2=' in str(widget.render())
978 979
    assert 'data-max-bounds-lng1=' in str(widget.render())
979 980
    assert 'data-max-bounds-lng2=' in str(widget.render())
981

  
982

  
983
def test_profile_fields_sorting():
984
    widget = ProfileUpdateRowWidget('profile')
985
    assert [f[1] for f in widget.get_widgets()[0].options] == ['Email', 'Name']
wcs/wf/profile.py
61 61
            for field in user_formdef.fields:
62 62
                if field.varname:
63 63
                    fields.append((field.varname, field.label, field.varname))
64
        fields = sorted(fields, key=lambda f: f[1])
64 65

  
65 66
        self.add(SingleSelectWidget, name='field_id', title=_('Field'),
66 67
                value=value.get('field_id'),
67
-