Closed elephantum closed 7 years ago
I made the changes that allow this, could you check your case on version from master branch (0.2.2-pre0
).
If everything is ok then I will release it.
class TreeWithCustomLevel(Base, BaseNestedSets):
__tablename__ = "tree_custom_level"
id = Column(Integer, primary_key=True)
visible = Column(Boolean)
sqlalchemy_mptt_default_level = 0
def __repr__(self):
return "<Node (%s)>" % self.id
@elephantum You can get it from PyPi now.
Cool, thanks!
How is the compatibility in general? I think it would be worth adding a note to the docs in this regard (where django-mptt is mentioned already).
Currently Django MPTT assigns level=0 to root nodes, while sqlalchemy_mptt assigns level=1 http://django-mptt.readthedocs.io/en/latest/technical_details.html?highlight=level#level
In our case we have to work with datastructures created in Django from Airflow/SQLAlchemy pipeline.
level
incompatibility makes it impossible to rely on filtering by level value to find all nodes at given depth.Are you willing to consider changing starting value of level from 1 to 0 to improve compatibility with Django MPTT?