src/core/models/term.py
changeset 83 4cdef872c351
parent 67 5d9223bb3aab
child 91 3bbf7371378a
equal deleted inserted replaced
82:8a67acd1f3aa 83:4cdef872c351
   106     notices = models.ManyToManyField('core.Notice', related_name="terms+", through="core.NoticeTerm")
   106     notices = models.ManyToManyField('core.Notice', related_name="terms+", through="core.NoticeTerm")
   107     
   107     
   108     parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
   108     parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
   109     
   109     
   110     @property
   110     @property
       
   111     def children_with_descendants(self):
       
   112         return self.children.extra(where=['(rght-lft) > 1'])
       
   113     
       
   114     @property
   111     def alternative_labels_str(self):
   115     def alternative_labels_str(self):
   112         return " | ".join([l.label for l in self.alternative_labels.all() if l.label != self.label])
   116         return " | ".join([l.label for l in self.alternative_labels.all() if l.label != self.label])
   113     
   117     
   114     @property
   118     @property
   115     def alternative_labels_list(self):
   119     def alternative_labels_list(self):