Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#67 closed enhancement (fixed)

Make specifying 'human-readable' name optional.

Reported by: mmarshall at myrealbox dot com Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I noticed that in the fields for the models in tutorial 1, three out of the four 'human-readable' names were identical to the 'machine-friendly' names.

Following the DRY principle, I think that the specifying the 'human-readable' name should be optional, defaulting to the machine-friendly name.

Here is a svn diff for a (trivial) implementation:

Index: django/core/
--- django/core/ (revision 174)
+++ django/core/ (working copy)
@@ -1564,13 +1564,13 @@
     # database level.
     empty_strings_allowed = True

-    def __init__(self, name, verbose_name, primary_key=False,
+    def __init__(self, name, verbose_name=None, primary_key=False,
         maxlength=None, unique=False, blank=False, null=False, db_index=None,
         core=False, rel=None, default=NOT_PROVIDED, editable=True,
         prepopulate_from=None, unique_for_date=None, unique_for_month=None,
         unique_for_year=None, validator_list=None, choices=None, radio_admin=None,
-, self.verbose_name = name, verbose_name
+, self.verbose_name = name, verbose_name or name
         self.primary_key = primary_key
         self.maxlength, self.unique = maxlength, unique
         self.blank, self.null = blank, null

Change History (1)

comment:1 Changed 15 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

Fixed in [212]. Great suggestion.

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