Fix dependent_objects support for multiple dependencies
This commit is contained in:
@@ -4,6 +4,12 @@ Changelog
|
|||||||
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
||||||
|
|
||||||
|
|
||||||
|
0.26.10 (2014-08-13)
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
- Fixed dependent_objects support for multiple dependencies
|
||||||
|
|
||||||
|
|
||||||
0.26.9 (2014-08-06)
|
0.26.9 (2014-08-06)
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@@ -44,7 +44,7 @@ for name, requirements in extras_require.items():
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='SQLAlchemy-Utils',
|
name='SQLAlchemy-Utils',
|
||||||
version='0.26.9',
|
version='0.26.10',
|
||||||
url='https://github.com/kvesteri/sqlalchemy-utils',
|
url='https://github.com/kvesteri/sqlalchemy-utils',
|
||||||
license='BSD',
|
license='BSD',
|
||||||
author='Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen',
|
author='Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen',
|
||||||
|
@@ -75,7 +75,7 @@ from .types import (
|
|||||||
from .models import Timestamp
|
from .models import Timestamp
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.26.8'
|
__version__ = '0.26.10'
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
@@ -78,6 +78,42 @@ class TestDependentObjects(TestCase):
|
|||||||
assert objects[3] in deps
|
assert objects[3] in deps
|
||||||
|
|
||||||
|
|
||||||
|
class TestDependentObjectsWithManyReferences(TestCase):
|
||||||
|
def create_models(self):
|
||||||
|
class User(self.Base):
|
||||||
|
__tablename__ = 'user'
|
||||||
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
first_name = sa.Column(sa.Unicode(255))
|
||||||
|
last_name = sa.Column(sa.Unicode(255))
|
||||||
|
|
||||||
|
class BlogPost(self.Base):
|
||||||
|
__tablename__ = 'blog_post'
|
||||||
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
author_id = sa.Column(sa.Integer, sa.ForeignKey('user.id'))
|
||||||
|
author = sa.orm.relationship(User)
|
||||||
|
|
||||||
|
class Article(self.Base):
|
||||||
|
__tablename__ = 'article'
|
||||||
|
id = sa.Column(sa.Integer, primary_key=True)
|
||||||
|
author_id = sa.Column(sa.Integer, sa.ForeignKey('user.id'))
|
||||||
|
author = sa.orm.relationship(User)
|
||||||
|
|
||||||
|
self.User = User
|
||||||
|
self.Article = Article
|
||||||
|
self.BlogPost = BlogPost
|
||||||
|
|
||||||
|
def test_with_many_dependencies(self):
|
||||||
|
user = self.User(first_name=u'John')
|
||||||
|
objects = [
|
||||||
|
self.Article(author=user),
|
||||||
|
self.BlogPost(author=user)
|
||||||
|
]
|
||||||
|
self.session.add_all(objects)
|
||||||
|
self.session.commit()
|
||||||
|
deps = list(dependent_objects(user))
|
||||||
|
assert len(deps) == 2
|
||||||
|
|
||||||
|
|
||||||
class TestDependentObjectsWithCompositeKeys(TestCase):
|
class TestDependentObjectsWithCompositeKeys(TestCase):
|
||||||
def create_models(self):
|
def create_models(self):
|
||||||
class User(self.Base):
|
class User(self.Base):
|
||||||
|
Reference in New Issue
Block a user