mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #8309: subclasses now inherit GenericForeignKey correctly. There's also now an internal API so that other "virtual fields" like GFK can be inherited as well. Thanks, msaelices.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8855 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -26,6 +26,7 @@ DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
|
||||
class Options(object):
|
||||
def __init__(self, meta, app_label=None):
|
||||
self.local_fields, self.local_many_to_many = [], []
|
||||
self.virtual_fields = []
|
||||
self.module_name, self.verbose_name = None, None
|
||||
self.verbose_name_plural = None
|
||||
self.db_table = ''
|
||||
@@ -155,6 +156,9 @@ class Options(object):
|
||||
if hasattr(self, '_name_map'):
|
||||
del self._name_map
|
||||
|
||||
def add_virtual_field(self, field):
|
||||
self.virtual_fields.append(field)
|
||||
|
||||
def setup_pk(self, field):
|
||||
if not self.pk and field.primary_key:
|
||||
self.pk = field
|
||||
|
||||
Reference in New Issue
Block a user