Opened 3 years ago

Closed 2 years ago

#22070 closed Bug (fixed)

Admin index shows mixed lowercase and capitalized app names when using contrib apps and old-style apps

Reported by: bendavis78 Owned by: jenkinsbr2
Component: Core (Other) Version: master
Severity: Release blocker Keywords: admin app-loading
Cc: bendavis78, jenkinsbr2 Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by timo)

The base AppConfig class uses self.label.title() for verbose_name if verbose_name is not supplied. The new AppConfigs in django.contrib use lowercase verbose names. This causes the admin index to look a bit sloppy when old-style apps are capitalized while new-style apps are all lowercase.

In my opinion, one of the following changes should be made:

  1. All contrib apps should follow the convention for verbose_names used by the default AppConfig
  2. The default AppConfig should follow the same convention for verbose name as the contrib apps
  3. The admin template should force all app names to use the same title convention (e.g., {% verbose_name|title %})

I'm in favor of any of these options -- the main goal here is consistency.

Change History (11)

comment:1 Changed 3 years ago by bendavis78

  • Cc bendavis78 added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 3 years ago by aaugustin

  • Keywords app-loading added

comment:3 Changed 2 years ago by timo

  • Description modified (diff)
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 2 years ago by jenkinsbr2

  • Cc jenkinsbr2 added
  • Owner changed from nobody to jenkinsbr2
  • Status changed from new to assigned

comment:5 Changed 2 years ago by jenkinsbr2

This seems like a good ticket for me to get my feet wet with a contribution. I'd just like to clarify a couple of things and see if my thinking is correct. Going through listed options, I'd tend to immediately discard option 2 - seems to me that title case is what we would want here. At first I thought option 3 would be the most elegant solution, however I realized that that will not take care of other instances in the page title, header, and breadcrumbs - do we care about title casing in those spots? I think the title case is generally nicer looking and of course the title filter could be added in several locations in the template, but unnecessary filters cluttering the template seems undesirable. All considered option 1 seems to be the easiest and most comprehensive change. My question is: do I simply change each instance of in django.contrib.* to reflect the correct title cased verbose name? Would it be more desirable to change the string or to call .title() on it?

I appreciate any feedback (and patience with dumb questions!)

comment:6 Changed 2 years ago by mjtamlyn

I think we should change the strings to be title case. Calling title() is a dead end - you might want the string to start with a lower case letter, eg "mYk's Gallery".

comment:7 Changed 2 years ago by jenkinsbr2

  • Has patch set
Last edited 2 years ago by jenkinsbr2 (previous) (diff)

comment:8 Changed 2 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In ec675ed6ccd1ad80e289dc01275e225552c489a3:

Fixed #22070 -- Changed verbose_name for apps in django.contrib to use title case

Thanks bendavis78 for the report.

comment:9 Changed 2 years ago by aaugustin

I disagree with that commit and I think it must be reverted.

Application names must be lower case for the same reason model names are lower case.

If templates need an title-cased version, they can title-ize or capitalize the value.

I've been working on a patch since last week-end and I hope to complete it this week-end.

comment:10 Changed 2 years ago by aaugustin

  • Component changed from contrib.admin to Core (Other)
  • Resolution fixed deleted
  • Severity changed from Normal to Release blocker
  • Status changed from closed to new
  • Type changed from Cleanup/optimization to Bug

comment:11 Changed 2 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

I changed my mind:

I'll reopen the ticket again if the discussion brings up new ideas.

Note: See TracTickets for help on using tickets.
Back to Top