Ticket #2029: admin_model_list_sort_by_name.patch
File admin_model_list_sort_by_name.patch, 1007 bytes (added by , 18 years ago) |
---|
-
django/contrib/admin/templatetags/adminapplist.py
42 43 }) 43 44 44 45 if model_list: 45 model_list.sort() 46 # Sort model_list by name key. 47 # We have to use verbose decorate-sort-undecorate pattern 48 # instead of key argument to sort() for python 2.3 compability 49 # http://wiki.python.org/moin/SortingListsOfDictionaries 50 decorated = [(x['name'], x) for x in model_list] 51 decorated.sort() 52 model_list = [x for key, x in decorated] 53 46 54 app_list.append({ 47 55 'name': app_label.title(), 48 56 'has_module_perms': has_module_perms,