Fixed #22778 -- Added a model Meta option to define default_related_name.

Thanks jorgecarleitao and mmardini for reviews.
This commit is contained in:
Renaud Parent 2014-06-06 16:16:17 +00:00 committed by Tim Graham
parent de90129070
commit 87d0a3384c
7 changed files with 120 additions and 2 deletions

View file

@ -20,7 +20,7 @@ DEFAULT_NAMES = ('verbose_name', 'verbose_name_plural', 'db_table', 'ordering',
'order_with_respect_to', 'app_label', 'db_tablespace',
'abstract', 'managed', 'proxy', 'swappable', 'auto_created',
'index_together', 'apps', 'default_permissions',
'select_on_save')
'select_on_save', 'default_related_name')
def normalize_together(option_together):
@ -99,6 +99,8 @@ class Options(object):
# A custom app registry to use, if you're making a separate model set.
self.apps = apps
self.default_related_name = None
@property
def app_config(self):
# Don't go through get_app_config to avoid triggering imports.