Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic relationship in an abstract node #654

Open
baltamar3 opened this issue Dec 9, 2022 · 0 comments
Open

dynamic relationship in an abstract node #654

baltamar3 opened this issue Dec 9, 2022 · 0 comments
Labels
documentation Issues requiring modifications to the documentation

Comments

@baltamar3
Copy link

How can I create a dynamic relationship in an abstract node which points to the same type of node that inherits from my Basenode?

I have tried using "Self" but it doesn't work

class BaseNode(StructuredNode):
    __abstract_node__ = True

    public_id = UniqueIdProperty()
    created_at = DateTimeProperty(default=timezone.now)
    deleted_at = DateTimeProperty()
    next_c = RelationshipTo(
        "self",
        "NEXT_C",
        cardinality=ZeroOrOne,
    )

class Phase(BaseNode):
  pass

class Model(BaseNode):
  pass

Example:

type(Phase.nodes.all(0).next_c.single()) == Phase
type(Model.nodes.all(0).next_c.single()) == Model
@mariusconjeaud mariusconjeaud added the documentation Issues requiring modifications to the documentation label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues requiring modifications to the documentation
Projects
None yet
Development

No branches or pull requests

2 participants