Code

Opened 6 years ago

Closed 6 years ago

#8470 closed (wontfix)

Documentation for verbose field names could suggest a DRY way to define verbose_name for foreign keys

Reported by: amiroff Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: verbose_name foreign key, foreign_key, ForeignKey
Cc: amiroff@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

At http://www.djangoproject.com/documentation/model-api/#verbose-field-names ,

Documentation states that we can use the following:

poll = models.ForeignKey(Poll, verbose_name="the related poll")

If you already have verbose_name defined under Meta class of Poll object, this way of defining it twice does not obey DRY principle.
In this case using the following way to specify verbose_name would improve the documentation:

poll = models.ForeignKey(Poll, verbose_name=Poll._meta.verbose_name)

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mtredinnick

  • milestone 1.0 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Things in _meta are not part of the public API and may change in the future, so this wouldn't be a good recommendation.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.