From f83d7b452983b4d93944f5749dc39fa6e86f5fca Mon Sep 17 00:00:00 2001 From: Omen Apps Date: Tue, 24 Nov 2020 10:36:11 -0500 Subject: [PATCH] Added methods to retrieve parent and child edges of a given node. --- django_postgresql_dag/models.py | 14 ++++++++++++++ setup.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/django_postgresql_dag/models.py b/django_postgresql_dag/models.py index f378277..dfb763b 100644 --- a/django_postgresql_dag/models.py +++ b/django_postgresql_dag/models.py @@ -374,6 +374,20 @@ def clan_edges(self): """ return self.ancestors_edges() | self.descendants_edges() + def parent_edges(self): + return edge_model.objects.filter( + child__in=[ + self, + ], + ) + + def child_edges(self): + return edge_model.objects.filter( + parent__in=[ + self, + ], + ) + @staticmethod def circular_checker(parent, child): if child in parent.self_and_ancestors(): diff --git a/setup.py b/setup.py index be3a905..e81dcf5 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os from setuptools import setup -version = '0.1.4' +version = '0.1.5' classifiers = [ "Development Status :: 3 - Alpha",