Ticket #9928: 9928.diff

File 9928.diff, 2.1 KB (added by Badri, 16 years ago)
  • django/contrib/admin/sites.py

     
    1212from django.views.decorators.cache import never_cache
    1313from django.conf import settings
    1414from django.utils.hashcompat import md5_constructor
     15from django.utils.datastructures import SortedDict
    1516
    1617ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
    1718LOGIN_FORM_KEY = 'this_is_the_login_form'
     
    3536    app_index_template = None
    3637
    3738    def __init__(self):
    38         self._registry = {} # model_class class -> admin_class instance
     39        self._registry = SortedDict({}) # model_class class -> admin_class instance
    3940
    4041    def register(self, model_or_iterable, admin_class=None, **options):
    4142        """
     
    304305        app_list = app_dict.values()
    305306        app_list.sort(lambda x, y: cmp(x['name'], y['name']))
    306307
    307         # Sort the models alphabetically within each app.
    308         for app in app_list:
    309             app['models'].sort(lambda x, y: cmp(x['name'], y['name']))
    310 
    311308        context = {
    312309            'title': _('Site administration'),
    313310            'app_list': app_list,
  • django/contrib/databrowse/sites.py

     
    33from django.contrib.databrowse.datastructures import EasyModel
    44from django.shortcuts import render_to_response
    55from django.utils.safestring import mark_safe
     6from django.utils.datastructures import SortedDict
    67
    78class AlreadyRegistered(Exception):
    89    pass
     
    7071
    7172class DatabrowseSite(object):
    7273    def __init__(self):
    73         self.registry = {} # model_class -> databrowse_class
     74        self.registry = SortedDict({}) # model_class -> databrowse_class
    7475        self.root_url = None
    7576
    7677    def register(self, model_or_iterable, databrowse_class=None, **options):
Back to Top