GithubHelp home page GithubHelp logo

Comments (5)

uralbash avatar uralbash commented on June 14, 2024 1

Could you give a link to django-mptt documentation where these functions are described I think it's not so hard to add

from sqlalchemy_mptt.

uralbash avatar uralbash commented on June 14, 2024 1

You can do this with simple queries, I'm not sure that it is correct to separate them into a separate method

get_siblings documentation
get_siblings definition

items = session.query(Tree).filter(Tree.parent_id == node.parent_id).all()

get_children documentation
get_children definition

items = session.query(Tree).filter(Tree.parent_id == node.id).all()

although maybe it makes sense to get this information directly from the object

from sqlalchemy_mptt.

uralbash avatar uralbash commented on June 14, 2024 1

@AlexZettler
You can use it in new 0.2.5 version of sqlalchemy_mptt
See examples:
https://github.com/uralbash/sqlalchemy_mptt/blob/master/sqlalchemy_mptt/tests/cases/get_node.py

from sqlalchemy_mptt.

AlexZettler avatar AlexZettler commented on June 14, 2024

Certainly! here are links to the documentation and the implementation source.

get_siblings documentation
get_siblings definition

get_children documentation
get_children definition

from sqlalchemy_mptt.

AlexZettler avatar AlexZettler commented on June 14, 2024

That's a really easy way to get that data. I'm still getting into SQAlchemy. I love readable code (hence my love for python) and will extend the class functionality for my project regardless. I would suggest implementing these methods for ease of development even if they are simple queries.

from sqlalchemy_mptt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.