Opened 19 years ago

Closed 19 years ago

Last modified 17 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

Description

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/meta.py
===================================================================
--- django/core/meta.py (revision 174)
+++ django/core/meta.py (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,
         help_text=''):
-        self.name, self.verbose_name = name, verbose_name
+        self.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 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

Fixed in [212]. Great suggestion.

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