Fix for inheritance bug and db_alias
This commit is contained in:
parent
83c11a9834
commit
3070e0bf5d
5 changed files with 29 additions and 11 deletions
|
|
@ -2999,7 +2999,7 @@ class DocumentTest(unittest.TestCase):
|
|||
self.assertEqual(User.objects.first(), bob)
|
||||
self.assertEqual(Book.objects.first(), hp)
|
||||
|
||||
# DeRefecence
|
||||
# DeReference
|
||||
class AuthorBooks(Document):
|
||||
author = ReferenceField(User)
|
||||
book = ReferenceField(Book)
|
||||
|
|
@ -3027,6 +3027,18 @@ class DocumentTest(unittest.TestCase):
|
|||
self.assertEqual(Book._get_collection(), get_db("testdb-2")[Book._get_collection_name()])
|
||||
self.assertEqual(AuthorBooks._get_collection(), get_db("testdb-3")[AuthorBooks._get_collection_name()])
|
||||
|
||||
def test_db_alias_propagates(self):
|
||||
"""db_alias propagates?
|
||||
"""
|
||||
class A(Document):
|
||||
name = StringField()
|
||||
meta = {"db_alias": "testdb-1", "allow_inheritance": True}
|
||||
|
||||
class B(A):
|
||||
pass
|
||||
|
||||
self.assertEquals('testdb-1', B._meta.get('db_alias'))
|
||||
|
||||
def test_db_ref_usage(self):
|
||||
""" DB Ref usage in __raw__ queries """
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue