Skip to content

Commit ab692e8

Browse files
committed
Merge pull request #51 from jirikuncar/configuration
mixins: fix of index columns names
2 parents 59540b2 + 1223be5 commit ab692e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sqlalchemy_mptt/mixins.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# vim:fenc=utf-8
44
#
55
# Copyright © 2014 uralbash <[email protected]>
6+
# Copyright © 2016 Jiri Kuncar <[email protected]>
67
#
78
# Distributed under terms of the MIT license.
89

@@ -43,12 +44,13 @@ class Tree(Base, BaseNestedSets):
4344
def __repr__(self):
4445
return "<Node (%s)>" % self.id
4546
"""
47+
4648
@declared_attr
4749
def __table_args__(cls):
4850
return (
49-
Index('%s_lft_idx' % cls.__tablename__, "lft"),
50-
Index('%s_rgt_idx' % cls.__tablename__, "rgt"),
51-
Index('%s_level_idx' % cls.__tablename__, "level"),
51+
Index('%s_lft_idx' % cls.__tablename__, cls.left.name),
52+
Index('%s_rgt_idx' % cls.__tablename__, cls.right.name),
53+
Index('%s_level_idx' % cls.__tablename__, cls.level.name),
5254
)
5355

5456
@classmethod

0 commit comments

Comments
 (0)