Ticket #6946: databrowse-sort-models.diff

File databrowse-sort-models.diff, 865 bytes (added by Adam Vandenberg, 14 years ago)

Updated patch; doesn't need 2.3 compatibility anymore (Django 1.3)

  • django/contrib/databrowse/sites.py

    diff --git a/django/contrib/databrowse/sites.py b/django/contrib/databrowse/sites.py
    index 172ca52..13d44e9 100644
    a b class DatabrowseSite(object):  
    122122        raise http.Http404('The requested databrowse page does not exist.')
    123123
    124124    def index(self, request):
    125         m_list = [EasyModel(self, m) for m in self.registry.keys()]
     125        # Sort by name, case insensitive. Python 2.4 compatible.
     126        sorted_keys = [m for m in self.registry.keys()]
     127        sorted_keys.sort(key = lambda x: x.__name__.upper())
     128        m_list = [EasyModel(self, m) for m in sorted_keys]
    126129        return render_to_response('databrowse/homepage.html', {'model_list': m_list, 'root_url': self.root_url})
    127130
    128131    def model_page(self, request, app_label, model_name, rest_of_url=None):
Back to Top