diff -r 349898dd5478 django/db/models/options.py
a
|
b
|
|
18 | 18 | # Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces". |
19 | 19 | get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip() |
20 | 20 | |
21 | | DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering', |
| 21 | DEFAULT_NAMES = ('verbose_name', 'verbose_name_plural', 'db_table', 'ordering', |
22 | 22 | 'unique_together', 'permissions', 'get_latest_by', |
23 | 23 | 'order_with_respect_to', 'app_label', 'db_tablespace', |
24 | 24 | 'abstract', 'managed', 'proxy') |
… |
… |
|
89 | 89 | |
90 | 90 | # verbose_name_plural is a special case because it uses a 's' |
91 | 91 | # by default. |
92 | | setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, 's'))) |
| 92 | if getattr(self, 'verbose_name_plural', None) is None: |
| 93 | setattr(self, 'verbose_name_plural', string_concat(self.verbose_name, 's')) |
93 | 94 | |
94 | 95 | # Any leftover attributes must be invalid. |
95 | 96 | if meta_attrs != {}: |
diff -r 349898dd5478 tests/regressiontests/model_inheritance_regress/models.py
a
|
b
|
|
109 | 109 | def __unicode__(self): |
110 | 110 | return "PK = %d, base_name = %s, derived_name = %s" \ |
111 | 111 | % (self.customPK, self.base_name, self.derived_name) |
| 112 | |
| 113 | class AuditBase(models.Model): |
| 114 | planned_date = models.DateTimeField() |
| 115 | |
| 116 | class Meta: |
| 117 | abstract = True |
| 118 | verbose_name_plural = u'Audits' |
| 119 | |
| 120 | class CertificationAudit(AuditBase): |
| 121 | |
| 122 | class Meta(AuditBase.Meta): |
| 123 | abstract = True |
| 124 | |
| 125 | class InternalCertificationAudit(CertificationAudit): |
| 126 | auditing_dept = models.CharField(max_length=20) |
112 | 127 | |
113 | 128 | __test__ = {'API_TESTS':""" |
114 | 129 | # Regression for #7350, #7202 |
… |
… |
|
318 | 333 | >>> ParkingLot3._meta.get_ancestor_link(Place).name # the child->parent link |
319 | 334 | "parent" |
320 | 335 | |
| 336 | # Regression for #11369: verbose_name_plural should be inherited from an ABC |
| 337 | # even when there is one or more additional intermediate abstract models in the |
| 338 | # inheritance chain. |
| 339 | >>> InternalCertificationAudit._meta.verbose_name_plural |
| 340 | u"Audits" |
| 341 | |
321 | 342 | """} |
322 | 343 | |