jinja2's tojson sorts keys in dicts by default. This was useful in the time when python's dicts were not ordered. However, now that dicts are ordered in python, this screws it up. Since profiles are dicts, ordering does matter - they should be displayed to the user in the order that the admin sets them. This allows template writers to use |tojson on the profile_list (to be read by JS) without worrying about ordering getting mangled. Template writers can still sort keys by explicitly using |dictsort in their template
jinja2's tojson sorts keys in dicts by default. This was useful in the time when python's dicts were not ordered. However, now that dicts are ordered in python, this screws it up. Since profiles are dicts, ordering does matter - they should be displayed to the user in the order that the admin sets them. This allows template writers to use
|tojson
on the profile_list (to be read by JS) without worrying about ordering getting mangled. Template writers can still sort keys by explicitly using|dictsort
in their template