class ConcreteEdge(edge_factory('ConcreteNode', concrete=False)): """ Test edge, adds just one field """ name = CharField(max_length=32, blank=True, null=True) class Meta: app_label = 'django_dag'
class TaskEdge(edge_factory(TaskNode, concrete=False)): name = models.CharField(max_length=100, blank=True, null=True) graph = models.ForeignKey('DiGraph', null=True, blank=True, on_delete=models.CASCADE) class Meta: verbose_name_plural = 'Dependencies' def save(self, *args, **kwargs): super(TaskEdge, self).save() self.graph = self.parent.graph super(TaskEdge, self).save()
class SectionRelation(edge_factory(Section, concrete=False)): """Through class for parent/child relationships between sections""" weight = models.IntegerField(default=0) def __unicode__(self): return u"%s is child of %s" % (self.child, self.parent)
class PlaceRelation(edge_factory(Place, concrete=False)): class Meta: unique_together = (("parent", "child"), )
class AnalysisEdge(edge_factory(AnalysisNode, concrete=False)): pass