Opened 3 years ago

Closed 3 years ago

#32219 closed New feature (fixed)

Use Admin Inline verbose_name as default for Inline verbose_name_plural

Reported by: Siburg Owned by: Siburg
Component: contrib.admin Version: 4.0
Severity: Normal Keywords: Admin Inline verbose_name_plural
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django allows specification of a verbose_name and a verbose_name_plural for Inline classes in admin views. However, verbose_name_plural for an Inline is not currently based on a specified verbose_name. Instead, it continues to be based on the model name, or an a verbose_name specified in the model's Meta class. This was confusing to me initially (I didn't understand why I had to specify both name forms for an Inline if I wanted to overrule the default name), and seems inconsistent with the approach for a model's Meta class (which does automatically base the plural form on a specified verbose_name). I propose that verbose_name_plural for an Inline class should by default be based on the verbose_name for an Inline if that is specified.

I have written a patch to implement this, including tests. Would be happy to submit that.

Change History (15)

comment:1 by Siburg, 3 years ago

Owner: changed from nobody to Siburg
Status: newassigned

comment:2 by Claude Paroz, 3 years ago

Please push your patch as a Django pull request.

in reply to:  2 comment:3 by Siburg, 3 years ago

Replying to Claude Paroz:

Please push your patch as a Django pull request.

Pull request is here: https://github.com/django/django/pull/13710

Does not yet contain documentation updates because I'm not sure where those should go. Failed the isort test because I did not change existing order of imports. Would be happy to make that change.

comment:4 by Siburg, 3 years ago

Responded to code review comment, and changed the import ordering and formatting while I was at it so it now passes the isort test as well.

comment:5 by Mariusz Felisiak, 3 years ago

Needs documentation: set
Triage Stage: UnreviewedAccepted

Sounds reasonable, thanks. Docs changes are missing, e.g. a release note about backwards incompatibility

comment:6 by Siburg, 3 years ago

Added

  • The default verbose_name_plural for an InlineModelAdmin (sub-)class is now its verbose_name + 's' if the verbose_name is specified in that InlineModelAdmin (sub-)class, instead of being the verbose_name_plural for the model class.

under the django.contrib.admin heading in the "Backwards incompatible changes in 3.2" section of the version 3.2 release notes.

Last edited 3 years ago by Siburg (previous) (diff)

comment:7 by Siburg, 3 years ago

Needs documentation: unset

comment:8 by Siburg, 3 years ago

Updated documentation as well. Figured out where it should go.

comment:9 by David Smith, 3 years ago

Patch needs improvement: set

comment:10 by Siburg, 3 years ago

Will do.

comment:11 by Siburg, 3 years ago

Patch needs improvement: unset
Version: 3.14.0

Updated documentation to reflect anticipated inclusion in version 4.0, added a versionchanged block and included links in the documentation.

comment:12 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set

comment:13 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 1bd6a7a:

Refs #32219 -- Added admin model inline tests for verbose names.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@…>

comment:14 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:15 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 46c8df6:

Fixed #32219 -- Made InlineModelAdmin.verbose_name_plural fallback to its verbose_name.

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