Opened 17 years ago
Closed 13 years ago
#6946 closed New feature (wontfix)
Alphabetize DatabrowseSite index view
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | contrib.databrowse | Version: | dev |
Severity: | Normal | Keywords: | alphabetize, index |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
In sites with a lot of models, it would be helpful if the DatabrowseSite
index view were alphabetized:
-
django/contrib/databrowse/sites.py
122 122 raise http.Http404('The requested databrowse page does not exist.') 123 123 124 124 def index(self, request): 125 m_list = [EasyModel(self, m) for m in s elf.registry.keys()]125 m_list = [EasyModel(self, m) for m in sorted(self.registry.keys(), lambda x,y:cmp(x.__name__,y.__name__))] 126 126 return render_to_response('databrowse/homepage.html', {'model_list': m_list, 'root_url': self.root_url}) 127 127 128 128 def model_page(self, request, app_label, model_name, rest_of_url=None):
Attachments (3)
Change History (10)
comment:1 by , 17 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 17 years ago
Attachment: | 6946.patch added |
---|
comment:2 by , 17 years ago
Needs tests: | set |
---|
follow-up: 4 comment:3 by , 17 years ago
the attached patch should sort case insensitive and should also be compatible with python2.4
I can't figure out how to run the Django unit tests (can't seem to get all the right settings) so a test is not included.
comment:4 by , 17 years ago
Replying to cstejerean:
the attached patch should sort case insensitive and should also be compatible with python2.4
Except now it isn't compatible with python2.3. Why not do what's outlined in the following patch?
comment:5 by , 17 years ago
is this any nicer?
if float(sys.version[:3]) >= 2.4: m_list.sort(key=str.lower) else: m_list = [(x.__name__.lower(), x) for x in m_list] m_list.sort() m_list = [x[1] for x in m_list]
by , 14 years ago
Attachment: | databrowse-sort-models.diff added |
---|
Updated patch; doesn't need 2.3 compatibility anymore (Django 1.3)
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
UI/UX: | unset |
Databrowse is now deprecated, see #16907
I think this is useful...however
sorted
is a python 2.5-ism and people will probably complain that it's case sensitive.