Code

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#9347 closed (fixed)

verbose_name option is missing in Model Field reference

Reported by: marcoberi Owned by: timo
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Below this option http://docs.djangoproject.com/en/dev/ref/models/fields/#unique-for-year I would put also verbose_name one.

Attachments (1)

verbose_field_doc.diff (1.0 KB) - added by timo 5 years ago.
initial patch

Download all attachments as: .zip

Change History (14)

comment:1 Changed 6 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

The verbose_name keyword argument for model fields is described in 'Writing Models' here:

http://docs.djangoproject.com/en/dev/topics/db/models/#verbose-field-names

I do not know that we want to (or generally do?) document things in two places. Someone more involved with the documentation structure needs to make that call.

comment:2 Changed 6 years ago by mtredinnick

  • Triage Stage changed from Design decision needed to Accepted

We can add a reference for this and then point to the current description. The reference section (ref/ directory) isn't really a complete reference if it's missing options. We don't have to duplicate the description, since inter-file linking is possible.

comment:3 Changed 6 years ago by ramiro

Actually, AFAIK, normal field types do not have a verbose_name option (it's only set using the first positional parameter of the model field declaration) but relationship fields do.

From the documentation location the OT suggests it seems he wants to add a blurb/link to the wrong place, if anything it should be added to the http://docs.djangoproject.com/en/dev/ref/models/fields/#module-django.db.models.fields.related section further down in the same document.

comment:4 follow-up: Changed 6 years ago by kmtracey

Any field can have a verbose_name specified. Not sure why you think it is restricted to relationship fields? The difference between specifying it for non-related and related is you may simply specify it as the first positional argument for any field that is not a ForeignKey, ManyToManyField or OneToOneField; that is you are not required to use the verbose_name keyword. But you certainly can. (The reason you cannot specify it as first positional for the others is that they require different first positional arguments, so for them you must use the verbose_name keyword if you want to specify it at all.)

comment:5 in reply to: ↑ 4 Changed 6 years ago by ramiro

Karen,
Replying to kmtracey:

Any field can have a verbose_name specified. Not sure why you think it is restricted to relationship fields? The difference between specifying it for non-related and related is you may simply specify it as the first positional argument for any field that is not a ForeignKey, ManyToManyField or OneToOneField; that is you are not required to use the verbose_name keyword. But you certainly can.

It' because the wording used here: http://docs.djangoproject.com/en/dev/topics/db/models/#verbose-field-names

I know that, strictly speaking, that section doesn't say normal fields don't support verbose_name but it only mentions they support usage of the first positional argument and contrast them agains the relationship fields. I hadn't looked up at the code that's why I wrote AFAIK.

comment:6 Changed 6 years ago by yoz

Speaking as someone who just wasted half an hour looking for the functionality offered by verbose_name, and who pored through the model field reference multiple times, I strongly endorse this ticket.

comment:7 Changed 6 years ago by seniorquico

Another vote for a fix. I'm new to Django, and the first place I went was http://docs.djangoproject.com/en/dev/ref/models/fields/. I was beginning to think it couldn't be done until I stumbled across this ticket.

comment:8 Changed 5 years ago by timo

  • Owner changed from nobody to timo
  • Status changed from new to assigned

Changed 5 years ago by timo

initial patch

comment:9 Changed 5 years ago by timo

  • Has patch set

comment:10 Changed 5 years ago by anonymous

  • Triage Stage changed from Accepted to Ready for checkin

comment:11 Changed 5 years ago by russellm

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

(In [9865]) Fixed #9347 -- Added an entry in the field reference for the verbose_name option. Thanks to marcoberi for the suggestion, and timo for the eventual patch.

comment:12 Changed 5 years ago by russellm

(In [9875]) [1.0.X] Fixed #9347 -- Added an entry in the field reference for the verbose_name option. Thanks to marcoberi for the suggestion, and timo for the eventual patch.

Merge of r9865 from trunk.

comment:13 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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.