Fix for inheritance bug and db_alias
This commit is contained in:
@@ -12,7 +12,7 @@ from signals import *
|
||||
__all__ = (document.__all__ + fields.__all__ + connection.__all__ +
|
||||
queryset.__all__ + signals.__all__)
|
||||
|
||||
VERSION = (0, 6, 15)
|
||||
VERSION = (0, 6, 16)
|
||||
|
||||
|
||||
def get_version():
|
||||
|
||||
@@ -649,8 +649,13 @@ class TopLevelDocumentMetaclass(DocumentMetaclass):
|
||||
del(attrs['meta']['collection'])
|
||||
if base._get_collection_name():
|
||||
collection = base._get_collection_name()
|
||||
# Propagate index options.
|
||||
for key in ('index_background', 'index_drop_dups', 'index_opts'):
|
||||
|
||||
# Propagate inherited values
|
||||
keys_to_propogate = (
|
||||
'index_background', 'index_drop_dups', 'index_opts',
|
||||
'allow_inheritance', 'queryset_class', 'db_alias',
|
||||
)
|
||||
for key in keys_to_propogate:
|
||||
if key in base._meta:
|
||||
base_meta[key] = base._meta[key]
|
||||
|
||||
@@ -659,11 +664,6 @@ class TopLevelDocumentMetaclass(DocumentMetaclass):
|
||||
abstract_base_indexes += base._meta.get('indexes', [])
|
||||
else:
|
||||
base_indexes += base._meta.get('indexes', [])
|
||||
# Propagate 'allow_inheritance'
|
||||
if 'allow_inheritance' in base._meta:
|
||||
base_meta['allow_inheritance'] = base._meta['allow_inheritance']
|
||||
if 'queryset_class' in base._meta:
|
||||
base_meta['queryset_class'] = base._meta['queryset_class']
|
||||
try:
|
||||
base_meta['objects'] = base.__getattribute__(base, 'objects')
|
||||
except TypeError:
|
||||
@@ -671,6 +671,7 @@ class TopLevelDocumentMetaclass(DocumentMetaclass):
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# defaults
|
||||
meta = {
|
||||
'abstract': False,
|
||||
'collection': collection,
|
||||
|
||||
Reference in New Issue
Block a user